1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-03 08:30:09 +00:00

Make set-visited-file-name reload local variables if needed.

* lisp/files.el (set-visited-file-name):
If the major-mode changed, reload the local variables.

Fixes: debbugs:9796
This commit is contained in:
Glenn Morris 2011-10-26 23:38:32 -07:00
parent 9c6c6f495b
commit 51bc5f8b73
2 changed files with 10 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2011-10-27 Glenn Morris <rgm@gnu.org>
* files.el (set-visited-file-name): If the major-mode changed,
reload the local variables. (Bug#9796)
2011-10-27 Chong Yidong <cyd@gnu.org>
* subr.el (change-major-mode-after-body-hook): New hook.

View File

@ -3682,7 +3682,11 @@ the old visited file has been renamed to the new name FILENAME."
(get major-mode 'mode-class)
;; Don't change the mode if the local variable list specifies it.
(hack-local-variables t)
(set-auto-mode t))
;; TODO consider making normal-mode handle this case.
(let ((old major-mode))
(set-auto-mode t)
(or (eq old major-mode)
(hack-local-variables))))
(error nil)))
(defun write-file (filename &optional confirm)