all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Sebastian Miele <iota@whxvd.name>
To: Jens Schmidt <jschmidt4gnu@vodafonemail.de>
Cc: Greg Minshall <minshall@umich.edu>, emacs-devel@gnu.org
Subject: Re: Emacs script options
Date: Tue, 21 Nov 2023 09:51:55 +0100	[thread overview]
Message-ID: <87y1erscxz.fsf@whxvd.name> (raw)
In-Reply-To: <208d9b6b-af64-432b-bc1d-f57e00ec0801@vodafonemail.de>

> From: Jens Schmidt <jschmidt4gnu@vodafonemail.de>
> Date: Mon, 2023-11-20 21:10 +0100
>
> On 2023-11-20  07:10, Sebastian Miele wrote:
>
>> But it has a problem with lexical binding.  Consider:
>>
>>   #!/bin/sh
>>   : ; exec emacs --script "$0" -- "$@" #; -*- lexical-binding: t; mode: emacs-lisp -*-
>>
>>   (defmacro lexical-binding-p ()
>>     '(let* ((x t)
>>             (f (lambda () x))
>>             (x nil))
>>        (funcall f)))
>>
>>   (message "%s %s" lexical-binding (lexical-binding-p))
>>
>> When I run it as a script, the output is "nil nil", i.e., the script
>> definitely does not run with lexical binding enabled.  When I evaluate
>> it in a buffer, the output is "t t".
>
> I tried byte-compiling something similar yesterday, which also
> indicated that the byte-compiler compiles with lexical bindings.  Only
> the scripting machinery sees dynamical bindings.
>
> […]  It seems that the scripting machinery expects a semicolon in the
> very first column, without that the lexical-binding line is not
> recognized.  Even a space before the semicolon breaks the recognition.
>
> The problem is in function `lisp_file_lexically_bound_p' from lread.c,
> which is indeed much more strict in its recognition of the -*- ... -*-
> stanza than the functions `set-auto-mode-1' and
> `hack-local-variables-prop-line' from files.el.  The Emacs manual
> ((emacs) Specifying File Variables) only mentions that the stanza
> has to be in the first line (or the second one if the first is taken
> by a she-bang), without any restriction where the comment has to
> start.

Thank you for the additional investigation into and information about
the issue.

> Would you or Greg report that as a bug?

Done, https://debbugs.gnu.org/cgi/bugreport.cgi?bug=67321.



  reply	other threads:[~2023-11-21  8:51 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-18  3:13 (unknown) Greg Minshall
2023-11-18  7:05 ` (unknown) Jim Porter
2023-11-18 14:10   ` (unknown) -x behavior change Greg Minshall
2023-11-18  7:36 ` Emacs script options Eli Zaretskii
2023-11-18 14:38   ` Greg Minshall
2023-11-18 16:20     ` Eli Zaretskii
2023-11-18 19:36       ` Greg Minshall
2023-11-19  5:55         ` Eli Zaretskii
2023-11-27  3:29   ` Greg Minshall
2023-11-27 12:59     ` Eli Zaretskii
2023-11-27 19:32       ` Greg Minshall
2023-11-18 19:18 ` Sebastian Miele
2023-11-18 19:49   ` Greg Minshall
2023-11-19 21:39     ` Jens Schmidt
2023-11-19 21:47       ` Jens Schmidt
2023-11-20  1:19         ` Greg Minshall
2023-11-21 21:13           ` Jens Schmidt
2023-11-22 18:17             ` Sebastian Miele
2023-11-22 20:18               ` Jens Schmidt
2023-11-24  4:22             ` Greg Minshall
2023-11-26 18:07               ` Jens Schmidt
2023-11-20  6:10         ` Sebastian Miele
2023-11-20 20:10           ` Jens Schmidt
2023-11-21  8:51             ` Sebastian Miele [this message]
2023-11-19  5:04   ` Bob Rogers
2023-11-19  6:21     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y1erscxz.fsf@whxvd.name \
    --to=iota@whxvd.name \
    --cc=emacs-devel@gnu.org \
    --cc=jschmidt4gnu@vodafonemail.de \
    --cc=minshall@umich.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.