Commit 51bc5f8b authored by Glenn Morris's avatar Glenn Morris
Browse files

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
parent 9c6c6f49
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> 2011-10-27 Chong Yidong <cyd@gnu.org>
* subr.el (change-major-mode-after-body-hook): New hook. * subr.el (change-major-mode-after-body-hook): New hook.
......
...@@ -3682,7 +3682,11 @@ the old visited file has been renamed to the new name FILENAME." ...@@ -3682,7 +3682,11 @@ the old visited file has been renamed to the new name FILENAME."
(get major-mode 'mode-class) (get major-mode 'mode-class)
;; Don't change the mode if the local variable list specifies it. ;; Don't change the mode if the local variable list specifies it.
(hack-local-variables t) (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))) (error nil)))
(defun write-file (filename &optional confirm) (defun write-file (filename &optional confirm)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment