[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs script options
|
From: |
Sebastian Miele |
|
Subject: |
Re: Emacs script options |
|
Date: |
Mon, 20 Nov 2023 07:10:00 +0100 |
> From: Jens Schmidt <jschmidt4gnu@vodafonemail.de>
> Date: Sun, 2023-11-19 22:47 +0100
>
> ------------------------- test -------------------------
> #!/bin/sh
> : ; exec emacs --script "$0" -- "$@" #; -*- lexical-binding: t -*-
> (message "%S" command-line-args-left)
> ------------------------- test -------------------------
This is the trick that Doom Emacs employs, see
https://github.com/doomemacs/doomemacs/blob/master/bin/doom.
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".
When I discovered the problem some while ago, I wanted to report it as
an issue to Doom Emacs, but the bars for reporting issues to that
specific project were set to high for me to actually go through the
process.
But maybe it should be reported as an Emacs bug?
- Re: Emacs script options, (continued)
- Re: Emacs script options, Sebastian Miele, 2023/11/18
- Re: Emacs script options, Greg Minshall, 2023/11/18
- Re: Emacs script options, Jens Schmidt, 2023/11/19
- Re: Emacs script options, Jens Schmidt, 2023/11/19
- Re: Emacs script options, Greg Minshall, 2023/11/19
- Re: Emacs script options, Jens Schmidt, 2023/11/21
- Re: Emacs script options, Sebastian Miele, 2023/11/22
- Re: Emacs script options, Jens Schmidt, 2023/11/22
- Re: Emacs script options, Greg Minshall, 2023/11/23
- Re: Emacs script options, Jens Schmidt, 2023/11/26
- Re: Emacs script options,
Sebastian Miele <=
- Re: Emacs script options, Jens Schmidt, 2023/11/20
- Re: Emacs script options, Sebastian Miele, 2023/11/21