diff options
author | Daniel Pfeiffer <occitan@esperanto.org> | 2004-11-04 20:25:08 +0000 |
---|---|---|
committer | Daniel Pfeiffer <occitan@esperanto.org> | 2004-11-04 20:25:08 +0000 |
commit | df4d061346b75da5366205536c74ac6442abbd7e (patch) | |
tree | 88c254e8eae74bf220b49a7b7b85ca8e5469288d /lisp | |
parent | 5dcd636bafa5ea99c11559e3a89bbbbaef604f52 (diff) | |
download | emacs-df4d061346b75da5366205536c74ac6442abbd7e.tar.gz emacs-df4d061346b75da5366205536c74ac6442abbd7e.tar.bz2 emacs-df4d061346b75da5366205536c74ac6442abbd7e.zip |
(set-auto-mode): Don't get error after setting -*-mode-*-.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/files.el | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lisp/files.el b/lisp/files.el index e9ae0fb834f..6ade94cd14d 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1912,6 +1912,7 @@ only set the major mode, if that would change it." (message "Ignoring unknown mode `%s'" mode) (setq done t) (or (set-auto-mode-0 mode keep-mode-if-same) + ;; continuing would call minor modes again, toggling them off (throw 'nop nil))))) ;; If we didn't, look for an interpreter specified in the first line. ;; As a special case, allow for things like "#!/bin/env perl", which @@ -1924,10 +1925,11 @@ only set the major mode, if that would change it." ;; Map interpreter name to a mode, signalling we're done at the ;; same time. done (assoc (file-name-nondirectory mode) - interpreter-mode-alist))) + interpreter-mode-alist)) + (if done + (set-auto-mode-0 (cdr done) keep-mode-if-same))) ;; If we found an interpreter mode to use, invoke it now. - (if done - (set-auto-mode-0 (cdr done) keep-mode-if-same) + (unless done (if (setq done (save-excursion (goto-char (point-min)) (assoc-default nil magic-mode-alist |