]> code.delx.au - gnu-emacs/commitdiff
(set-auto-mode): When just-from-file-name is set, don't
authorRichard M. Stallman <rms@gnu.org>
Sun, 26 Apr 1998 04:19:28 +0000 (04:19 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sun, 26 Apr 1998 04:19:28 +0000 (04:19 +0000)
actually switch modes if the new mode is the same as the current one.

lisp/files.el

index ea718410bd37ae6425049abd1cf20ec65c929500..60a45aac4b5ea031853830440d624db3b21a87d6 100644 (file)
@@ -1391,7 +1391,13 @@ and we don't even do that unless it would come from the file name."
                              keep-going nil)))
                  (setq alist (cdr alist))))
              (if mode
-                 (funcall mode)
+                 ;; When JUST-FROM-FILE-NAME is set,
+                 ;; we are working on behalf of set-visited-file-name.
+                 ;; In that case, if the major mode specified is the
+                 ;; same one we already have, don't actually reset it.
+                 ;; We don't want to lose minor modes such as Font Lock.
+                 (unless (and just-from-file-name (eq mode major-mode))
+                   (funcall mode))
                ;; If we can't deduce a mode from the file name,
                ;; look for an interpreter specified in the first line.
                ;; As a special case, allow for things like "#!/bin/env perl",