GNU bug report logs - #23463
safe local variable properties no longer effective

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Thu, 5 May 2016 22:01:02 UTC

Severity: normal

Merged with 23460

Found in version 25.1.50

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Alan Mackenzie <acm <at> muc.de>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 23463 <at> debbugs.gnu.org
Subject: bug#23463: safe local variable properties no longer effective
Date: Fri, 6 May 2016 09:14:54 +0000
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).




This bug report was last modified 9 years and 76 days ago.

Previous Next


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