From: Eli Zaretskii <eliz@gnu.org>
To: LdBeth <andpuke@foxmail.com>
Cc: 64272@debbugs.gnu.org, andpuke@foxmail.com, monnier@iro.umontreal.ca
Subject: bug#64272: 28.1; lisp_file_lexically_bound_p behavior mismatches file local variables
Date: Sun, 25 Jun 2023 21:16:53 +0300 [thread overview]
Message-ID: <83h6qvxv8q.fsf@gnu.org> (raw)
In-Reply-To: <tencent_B85B85FC3DB9AD753B38E2F5546120EB480A@qq.com> (message from LdBeth on Sun, 25 Jun 2023 12:17:40 -0500)
> Date: Sun, 25 Jun 2023 12:17:40 -0500
> From: LdBeth <andpuke@foxmail.com>
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>,
> andpuke@foxmail.com,
> 64272@debbugs.gnu.org
>
> >>>>> In <83mt0ny47z.fsf@gnu.org>
> >>>>> Eli Zaretskii <eliz@gnu.org> wrote:
>
> Eli> I'm not sure we want to support this outside of a Lisp comment.
> Eli> Stefan, WDYT? Could false positives cause harm?
>
> Stefan> I'd much rather we try and stay as close as possible to the behavior of
> Stefan> `hack-local-variables-prop-line`
>
> Eli> The fact that most -*- lines are in comments is because they are in
> Eli> program source files, so we need to hide them from the compiler or the
> Eli> interpreter.
>
> Eli> Am I missing something?
>
> Ok I find the reason the `lisp_file_lexically_bound_p' would give
> up if the first line isn't a comment is, it said:
>
> Return true if the lisp code read using READCHARFUN defines a non-nil
> `lexical-binding' file variable. After returning, the stream is
> positioned following the first line, if it is a comment or #! line,
> otherwise nothing is read.
>
> So this function assumes the first line is discarded if file local
> variables would have been read.
>
> If first line is lisp code, and we want to keep the similar
> behavior of `hack-local-variables-prop-line`, there needs a mean
> to buffer the content of the first line. (Or reset file position
> but I don't think there is a way to do that without
> substantially change lread.c)
There isn't. We can only unread one character at a time.
> But it would be easier to only handle the extra whitespace at
> beginning of file.
So now let me turn the table and ask: if we are only going to support
whitespace before the semicolon, then what exactly are we gaining
here?
next prev parent reply other threads:[~2023-06-25 18:16 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-24 18:22 bug#64272: 28.1; lisp_file_lexically_bound_p behavior mismatches file local variables LdBeth
2023-06-24 18:52 ` Eli Zaretskii
2023-06-24 19:08 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-25 2:11 ` LdBeth
2023-06-25 6:08 ` Eli Zaretskii
2023-06-25 13:37 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-25 15:02 ` Eli Zaretskii
2023-06-25 15:42 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-25 17:17 ` LdBeth
2023-06-25 18:16 ` Eli Zaretskii [this message]
2023-06-25 23:00 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-26 0:53 ` LdBeth
2023-06-26 11:13 ` Eli Zaretskii
2023-06-26 15:18 ` Gregory Heytings
2023-06-26 15:23 ` Eli Zaretskii
2023-11-21 13:12 ` Gerd Möllmann
2023-06-26 10:59 ` Eli Zaretskii
2023-06-25 23:16 ` LdBeth
2023-06-26 0:45 ` LdBeth
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83h6qvxv8q.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=64272@debbugs.gnu.org \
--cc=andpuke@foxmail.com \
--cc=monnier@iro.umontreal.ca \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).