[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs script options
From: |
Jens Schmidt |
Subject: |
Re: Emacs script options |
Date: |
Tue, 21 Nov 2023 22:13:22 +0100 |
User-agent: |
Mozilla Thunderbird |
On 2023-11-20 02:19, Greg Minshall wrote:
> no way, NO way near hack'y enough. :)
I couldn't stand the fact that my hack was taken already plus
that it is flawed, so I set off to extend it with a work-around
for the lexical-binding issue.
While there are surely other methods to achieve what below code
does, supposedly also more stable ones, I wanted to go for
brevity to keep the non-script overhead small:
------------------------- escript -------------------------
#!/bin/sh
: ; exec emacs --script "$0" -- "$@" #; -*- lexical-binding: t -*-
;; Work around `eval-buffer' not recognizing the lexical-binding
;; stanza when the comment containing it does not start at first
;; column (bug#67321).
(unless (ignore-errors (funcall (let ((v t)) (lambda () v))))
(with-current-buffer (car eval-buffer-list)
(goto-char (point-min)) (search-forward "; -*-")
(delete-region (point-min) (match-beginning 0))
(eval-buffer)))
;; Script payload.
(message "%S:%S" lexical-binding command-line-args-left)
;; Explicitly exit Emacs to not return from the second-level
;; `eval-buffer'.
(kill-emacs 0)
;;; Local Variables:
;;; mode: emacs-lisp
;;; End:
------------------------- escript -------------------------
(Thanks to Sebastian for opening the bug, BTW. When looking at
the previous, now merged bug, it seems that this won't be
something easy to get through.)
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 <=
- 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, 2023/11/20
Re: Emacs script options, Jens Schmidt, 2023/11/20
Re: Emacs script options, Sebastian Miele, 2023/11/21