]> code.delx.au - gnu-emacs/commitdiff
Correct hack-local-variables change from Thu May 5 11:05:49 2016 +0000
authorAlan Mackenzie <acm@muc.de>
Fri, 6 May 2016 18:58:49 +0000 (18:58 +0000)
committerAlan Mackenzie <acm@muc.de>
Fri, 6 May 2016 18:58:49 +0000 (18:58 +0000)
Prevent hack-local-variables being called from the fundamental-mode mode call
early in normal-mode.  This fixes bug #23460 and bug #23463.

* lisp/files.el (normal-mode) Replace call to fundamental-mode with calls to
the things it calls, with the exception of hack-local-variables.

* etc/NEWS: Add an entry to note the calling of hack-local-variables at each
major mode initialization.

etc/NEWS
lisp/files.el

index 29559d143db649149bd9383909dce56ca26e4b29..1d5d0d6458493973e8dc5ec313f14c877ddd2217 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -155,6 +155,11 @@ These variables are for users who would like to avoid the small
 probability of data corruption due to techniques Emacs uses to recover
 in these situations.
 
 probability of data corruption due to techniques Emacs uses to recover
 in these situations.
 
++++
+** File local and directory local variables are now initialized each
+time the major mode is set, not just when the file is first visited.
+These local variables will thus not vanish on setting a major mode.
+
 +++
 ** A second dir-local file (.dir-locals-2.el) is now accepted.
 See the variable 'dir-locals-file-2' for more information.
 +++
 ** A second dir-local file (.dir-locals-2.el) is now accepted.
 See the variable 'dir-locals-file-2' for more information.
index d89b2f5258209db287e52e40e3872659ecc9a64c..21f7bdc7dcf0fc66ad7ea1a69bfd68c0c3f062d0 100644 (file)
@@ -2316,7 +2316,10 @@ not set local variables (though we do notice a mode specified with -*-.)
 or from Lisp without specifying the optional argument FIND-FILE;
 in that case, this function acts as if `enable-local-variables' were t."
   (interactive)
 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:".
   (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:".