From: Richard M. Stallman Date: Sun, 26 Apr 1998 04:19:28 +0000 (+0000) Subject: (set-auto-mode): When just-from-file-name is set, don't X-Git-Tag: emacs-20.3~1303 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3b9ffb776b211da8bc9394ec435baa95f01f0161;p=emacs.git (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. --- diff --git a/lisp/files.el b/lisp/files.el index ea718410bd3..60a45aac4b5 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -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",