GNU bug report logs - #64272
28.1; lisp_file_lexically_bound_p behavior mismatches file local variables

Previous Next

Package: emacs;

Reported by: LdBeth <andpuke <at> foxmail.com>

Date: Sat, 24 Jun 2023 18:24:02 UTC

Severity: normal

Tags: confirmed

Merged with 67321

Found in versions 28.1, 29.1.90

Full log


View this message in rfc822 format

From: LdBeth <andpuke <at> foxmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 64272 <at> debbugs.gnu.org, LdBeth <andpuke <at> foxmail.com>, monnier <at> iro.umontreal.ca
Subject: bug#64272: 28.1; lisp_file_lexically_bound_p behavior mismatches file local variables
Date: Sun, 25 Jun 2023 18:16:36 -0500
>>>>> In <83h6qvxv8q.fsf <at> gnu.org> 
>>>>>	Eli Zaretskii <eliz <at> gnu.org> wrote:
ldb> If first line is lisp code, and we want to keep the similar
ldb> behavior of `hack-local-variables-prop-line`, there needs a mean
ldb> to buffer the content of the first line. (Or reset file position
ldb> but I don't think there is a way to do that without
ldb> substantially change lread.c)

Eli> There isn't.  We can only unread one character at a time.

ldb> But it would be easier to only handle the extra whitespace at
ldb> beginning of file.

Eli> So now let me turn the table and ask: if we are only going to support
Eli> whitespace before the semicolon, then what exactly are we gaining
Eli> here?

Haha, we would gain pretty much nothing useful if the issue not resolved.


So as I continue digging into lread.c and trying to find alternative
solutions, I find these:

  DEFSYM (Qget_file_char, "get-file-char");

  /* Used instead of Qget_file_char while loading *.elc files compiled
     by Emacs 21 or older.  */
  DEFSYM (Qget_emacs_mule_file_char, "get-emacs-mule-file-char");

While `get-file-char` is exposed to emacs lisp,
`get-emacs-mule-file-char' is not even a defined lisp function.

There are multiple places in `lread.c` that handles
`Qget_emacs_mule_file_char`. Which I believe it time to consider
them as dead code and remove them.

For the only two functions that calls `lisp_file_lexically_bound_p`,
`load` is hard coded to use `get-file-char` which is a wrapper around
`getc()`, and `eval-buffer` uses the `BUFFERP (readcharfun)`
branch in `readchar`. I think both case can be changed to
use a more flexible way to test file local variables
rather than stick to the READCHAR UNREAD api.

---
ldb





This bug report was last modified 1 year and 156 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.