aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2011-10-26 23:38:32 -0700
committerGlenn Morris2011-10-26 23:38:32 -0700
commit51bc5f8b7385d8e632add4f70ca091ebe7a32799 (patch)
tree15a48fb53346fd9f0247c62a39bc2c3a96f8d153
parent9c6c6f495b8469ca5e105f5ddb02a69d1303a106 (diff)
downloademacs-51bc5f8b7385d8e632add4f70ca091ebe7a32799.tar.gz
emacs-51bc5f8b7385d8e632add4f70ca091ebe7a32799.zip
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
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/files.el6
2 files changed, 10 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f4a0ceecf93..cbfc662da52 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12011-10-27 Glenn Morris <rgm@gnu.org>
2
3 * files.el (set-visited-file-name): If the major-mode changed,
4 reload the local variables. (Bug#9796)
5
12011-10-27 Chong Yidong <cyd@gnu.org> 62011-10-27 Chong Yidong <cyd@gnu.org>
2 7
3 * subr.el (change-major-mode-after-body-hook): New hook. 8 * subr.el (change-major-mode-after-body-hook): New hook.
diff --git a/lisp/files.el b/lisp/files.el
index 3ed9bd5a272..40e2df14c1b 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3682,7 +3682,11 @@ the old visited file has been renamed to the new name FILENAME."
3682 (get major-mode 'mode-class) 3682 (get major-mode 'mode-class)
3683 ;; Don't change the mode if the local variable list specifies it. 3683 ;; Don't change the mode if the local variable list specifies it.
3684 (hack-local-variables t) 3684 (hack-local-variables t)
3685 (set-auto-mode t)) 3685 ;; TODO consider making normal-mode handle this case.
3686 (let ((old major-mode))
3687 (set-auto-mode t)
3688 (or (eq old major-mode)
3689 (hack-local-variables))))
3686 (error nil))) 3690 (error nil)))
3687 3691
3688(defun write-file (filename &optional confirm) 3692(defun write-file (filename &optional confirm)