unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Glenn Morris <rgm@gnu.org>
Cc: 23463@debbugs.gnu.org
Subject: bug#23463: safe local variable properties no longer effective
Date: Fri, 6 May 2016 09:14:54 +0000	[thread overview]
Message-ID: <20160506091453.GA3898@acm.fritz.box> (raw)
In-Reply-To: <t6r3dgdv38.fsf@fencepost.gnu.org>

Hello, Glenn.

On Thu, May 05, 2016 at 05:59:55PM -0400, Glenn Morris wrote:
> Package: emacs
> Version: 25.1.50

> emacs -Q foo.py

> where foo.py has contents:

> # Local Variables:
> # python-indent-offset: 2
> # End:

> Current emacs-25 branch: file opens fine with no prompting,
> python-indent-offset is set to 2.
> Current master: one is told that python-indent-offset is not safe

Yes.  What is happening is that the call to `fundamental-mode' at the
beginning of `normal-mode' is itself calling `hack-local-variables' (via
`run-mode-hooks').  This is wrong.  At that stage, python-mode has not
yet been loaded, so `hack-local-variables' doesn't know that
`python-indent-offset' is "safe".

> Same applies to any similar major-mode-specific local variable.

> This is due to 25f455815bfaa868dc470d445413df9a7a546c46.

Please try out the following, and let me know how it works:



diff --git a/lisp/files.el b/lisp/files.el
index d89b2f5..21f7bdc 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2316,7 +2316,10 @@ normal-mode
 or from Lisp without specifying the optional argument FIND-FILE;
 in that case, this function acts as if `enable-local-variables' were t."
   (interactive)
-  (fundamental-mode)
+  (kill-all-local-variables)
+  (unless delay-mode-hooks
+    (run-hooks 'change-major-mode-after-body-hook
+               'after-change-major-mode-hook))
   (let ((enable-local-variables (or (not find-file) enable-local-variables)))
     ;; FIXME this is less efficient than it could be, since both
     ;; s-a-m and h-l-v may parse the same regions, looking for "mode:".


-- 
Alan Mackenzie (Nuremberg, Germany).





  reply	other threads:[~2016-05-06  9:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-05 21:59 bug#23463: safe local variable properties no longer effective Glenn Morris
2016-05-06  9:14 ` Alan Mackenzie [this message]
2016-05-06 15:55   ` Glenn Morris
2016-05-06 19:34     ` Alan Mackenzie
2016-05-06 19:24 ` Alan Mackenzie

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=20160506091453.GA3898@acm.fritz.box \
    --to=acm@muc.de \
    --cc=23463@debbugs.gnu.org \
    --cc=rgm@gnu.org \
    /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).