From: Glenn Morris <rgm@gnu.org>
To: John Kitchin <jkitchin@andrew.cmu.edu>
Cc: 24452@debbugs.gnu.org
Subject: bug#24452: 25.1.50; add/delete-file-local-variable does not work as expected
Date: Sat, 17 Sep 2016 12:48:53 -0400 [thread overview]
Message-ID: <g0wpiazd3e.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <m2intveeai.fsf@andrew.cmu.edu> (John Kitchin's message of "Fri, 16 Sep 2016 17:16:21 -0400")
John Kitchin wrote:
> In the add-file-local-variable and related functions, the local
> variables are found with code like:
>
> (search-forward "Local Variables:" nil t)
It uses the same logic as the function that actually applies file local
variables (hack-local-variables).
> This is too open I think, and leads to errors in files that contain that
> phrase in places near the end of the file that aren't related to Local
> Variables. For example, in code that is searching for that string, or in
> text files that talk about Local Variables.
Then you would already have had a more obvious issue when visiting the
file in the first place. The format of Local Variables is too
long-established to be changed now, and there's no point
add-file-local-variable being stricter than hack-local-variables.
The standard solution is eg to add a ^L, or obfuscate the "Local
Variables", so it's not picked up.
> I think the search should be done with a regexp that considers the start
> of a line and comment-start:
>
> (format "^%s+ Local Variables:" comment-start)
Some files have no comment syntax. In some that do, there's no need for
the LV section to use it (eg it could be after the "end{document}" in a
latex file, or inside #if 0 in C). And then there's the case where
comment-start is itself specified in the LV section.
next prev parent reply other threads:[~2016-09-17 16:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-16 21:16 bug#24452: 25.1.50; add/delete-file-local-variable does not work as expected John Kitchin
2016-09-17 16:48 ` Glenn Morris [this message]
2016-09-19 12:57 ` John Kitchin
2020-08-12 1:48 ` Stefan Kangas
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=g0wpiazd3e.fsf@fencepost.gnu.org \
--to=rgm@gnu.org \
--cc=24452@debbugs.gnu.org \
--cc=jkitchin@andrew.cmu.edu \
/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).