# HG changeset patch # User Richard M. Stallman # Date 893564368 0 # Node ID c718d675ee931281abb881cc47656c3b3866c1d0 # Parent 95df64150c8a07075f2b1702aa8de46237ed624d (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 -r 95df64150c8a -r c718d675ee93 lisp/files.el --- 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",