diff options
| author | Jim Blandy | 1993-05-19 06:03:04 +0000 |
|---|---|---|
| committer | Jim Blandy | 1993-05-19 06:03:04 +0000 |
| commit | dd573bc0e5b31fabaa671022ea3635b63fe540fc (patch) | |
| tree | 8ab75d2bd40abd73f66b59a9279e1a1c84e4062e | |
| parent | e44320953357900a80cd0b9a5e8e832f1005c457 (diff) | |
| download | emacs-dd573bc0e5b31fabaa671022ea3635b63fe540fc.tar.gz emacs-dd573bc0e5b31fabaa671022ea3635b63fe540fc.zip | |
* files.el (set-auto-mode): If the buffer's file name is nil,
don't try to compare it against the entries in auto-mode-alist.
| -rw-r--r-- | lisp/files.el | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/lisp/files.el b/lisp/files.el index 64ba881b71a..6a207dbec7b 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -798,16 +798,17 @@ If `enable-local-variables' is nil, this function does not check for a | |||
| 798 | (setq mode (buffer-substring beg (point)))))) | 798 | (setq mode (buffer-substring beg (point)))))) |
| 799 | (setq mode (buffer-substring beg end))))) | 799 | (setq mode (buffer-substring beg end))))) |
| 800 | (setq mode (intern (concat (downcase mode) "-mode"))) | 800 | (setq mode (intern (concat (downcase mode) "-mode"))) |
| 801 | (let ((alist auto-mode-alist) | 801 | (if buffer-file-name |
| 802 | (name buffer-file-name)) | 802 | (let ((alist auto-mode-alist) |
| 803 | (let ((case-fold-search (eq system-type 'vax-vms))) | 803 | (name buffer-file-name)) |
| 804 | ;; Remove backup-suffixes from file name. | 804 | (let ((case-fold-search (eq system-type 'vax-vms))) |
| 805 | (setq name (file-name-sans-versions name)) | 805 | ;; Remove backup-suffixes from file name. |
| 806 | ;; Find first matching alist entry. | 806 | (setq name (file-name-sans-versions name)) |
| 807 | (while (and (not mode) alist) | 807 | ;; Find first matching alist entry. |
| 808 | (if (string-match (car (car alist)) name) | 808 | (while (and (not mode) alist) |
| 809 | (setq mode (cdr (car alist)))) | 809 | (if (string-match (car (car alist)) name) |
| 810 | (setq alist (cdr alist))))))) | 810 | (setq mode (cdr (car alist)))) |
| 811 | (setq alist (cdr alist)))))))) | ||
| 811 | (if mode (funcall mode)))) | 812 | (if mode (funcall mode)))) |
| 812 | 813 | ||
| 813 | (defun hack-local-variables-prop-line () | 814 | (defun hack-local-variables-prop-line () |