diff options
| author | Richard M. Stallman | 1998-04-26 04:19:28 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-04-26 04:19:28 +0000 |
| commit | 3b9ffb776b211da8bc9394ec435baa95f01f0161 (patch) | |
| tree | 16d8e3aa1273315fcb2c820bd1401e40b7e258b5 | |
| parent | 7f9fcc0f575acde4bbbfd696274784d8db17912e (diff) | |
| download | emacs-3b9ffb776b211da8bc9394ec435baa95f01f0161.tar.gz emacs-3b9ffb776b211da8bc9394ec435baa95f01f0161.zip | |
(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.
| -rw-r--r-- | lisp/files.el | 8 |
1 files changed, 7 insertions, 1 deletions
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." | |||
| 1391 | keep-going nil))) | 1391 | keep-going nil))) |
| 1392 | (setq alist (cdr alist)))) | 1392 | (setq alist (cdr alist)))) |
| 1393 | (if mode | 1393 | (if mode |
| 1394 | (funcall mode) | 1394 | ;; When JUST-FROM-FILE-NAME is set, |
| 1395 | ;; we are working on behalf of set-visited-file-name. | ||
| 1396 | ;; In that case, if the major mode specified is the | ||
| 1397 | ;; same one we already have, don't actually reset it. | ||
| 1398 | ;; We don't want to lose minor modes such as Font Lock. | ||
| 1399 | (unless (and just-from-file-name (eq mode major-mode)) | ||
| 1400 | (funcall mode)) | ||
| 1395 | ;; If we can't deduce a mode from the file name, | 1401 | ;; If we can't deduce a mode from the file name, |
| 1396 | ;; look for an interpreter specified in the first line. | 1402 | ;; look for an interpreter specified in the first line. |
| 1397 | ;; As a special case, allow for things like "#!/bin/env perl", | 1403 | ;; As a special case, allow for things like "#!/bin/env perl", |