aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/NEWS5
-rw-r--r--lisp/files.el5
2 files changed, 9 insertions, 1 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 29559d143db..1d5d0d64584 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -156,6 +156,11 @@ probability of data corruption due to techniques Emacs uses to recover
156in these situations. 156in these situations.
157 157
158+++ 158+++
159** File local and directory local variables are now initialized each
160time the major mode is set, not just when the file is first visited.
161These local variables will thus not vanish on setting a major mode.
162
163+++
159** A second dir-local file (.dir-locals-2.el) is now accepted. 164** A second dir-local file (.dir-locals-2.el) is now accepted.
160See the variable 'dir-locals-file-2' for more information. 165See the variable 'dir-locals-file-2' for more information.
161 166
diff --git a/lisp/files.el b/lisp/files.el
index d89b2f52582..21f7bdc7dcf 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2316,7 +2316,10 @@ not set local variables (though we do notice a mode specified with -*-.)
2316or from Lisp without specifying the optional argument FIND-FILE; 2316or from Lisp without specifying the optional argument FIND-FILE;
2317in that case, this function acts as if `enable-local-variables' were t." 2317in that case, this function acts as if `enable-local-variables' were t."
2318 (interactive) 2318 (interactive)
2319 (fundamental-mode) 2319 (kill-all-local-variables)
2320 (unless delay-mode-hooks
2321 (run-hooks 'change-major-mode-after-body-hook
2322 'after-change-major-mode-hook))
2320 (let ((enable-local-variables (or (not find-file) enable-local-variables))) 2323 (let ((enable-local-variables (or (not find-file) enable-local-variables)))
2321 ;; FIXME this is less efficient than it could be, since both 2324 ;; FIXME this is less efficient than it could be, since both
2322 ;; s-a-m and h-l-v may parse the same regions, looking for "mode:". 2325 ;; s-a-m and h-l-v may parse the same regions, looking for "mode:".