Subject: bug#67321: 29.1.90; Different parsing rules for -*- lexical-binding:t; -*- in different circumstances

From: Sebastian Miele <[email-masked]>
Date: Tue, 21 Nov 2023 12:07:59 +0100

> From: Andreas Schwab <[email-masked]>
> Date: Tue, 2023-11-21 11:06 +0100
>
> There are no different parsing rules.  emacs --script just doesn't pay
> attention to file local variables.

That cannot be true.  Running

  #!/path/to/emacs --script
  ;; -*- 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))

as a script outputs "t t".  When I change the "lexical-binding: t" into
"lexical-binding: nil", the output is "nil nil".  So that special
file-local variable does receive some handling by emacs --script.