changeset 21773:c718d675ee93

(set-auto-mode): When just-from-file-name is set, don't actually switch modes if the new mode is the same as the current one.
author Richard M. Stallman <rms@gnu.org>
date Sun, 26 Apr 1998 04:19:28 +0000
parents 95df64150c8a
children 101cc2e8a4b7
files lisp/files.el
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/files.el	Sun Apr 26 04:09:09 1998 +0000
+++ b/lisp/files.el	Sun Apr 26 04:19:28 1998 +0000
@@ -1391,7 +1391,13 @@
 			      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",