changeset 2896:6aa7bdef44fc

* 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.
author Jim Blandy <jimb@redhat.com>
date Wed, 19 May 1993 06:03:04 +0000
parents 1ed91566882a
children a2c9db9253e1
files lisp/files.el
diffstat 1 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/files.el	Wed May 19 06:01:21 1993 +0000
+++ b/lisp/files.el	Wed May 19 06:03:04 1993 +0000
@@ -798,16 +798,17 @@
 			     (setq mode (buffer-substring beg (point))))))
 		   (setq mode (buffer-substring beg end)))))
 	  (setq mode (intern (concat (downcase mode) "-mode")))
-	(let ((alist auto-mode-alist)
-	      (name buffer-file-name))
-	  (let ((case-fold-search (eq system-type 'vax-vms)))
-	    ;; Remove backup-suffixes from file name.
-	    (setq name (file-name-sans-versions name))
-	    ;; Find first matching alist entry.
-	    (while (and (not mode) alist)
-	      (if (string-match (car (car alist)) name)
-		  (setq mode (cdr (car alist))))
-	      (setq alist (cdr alist)))))))
+	(if buffer-file-name
+	    (let ((alist auto-mode-alist)
+		  (name buffer-file-name))
+	      (let ((case-fold-search (eq system-type 'vax-vms)))
+		;; Remove backup-suffixes from file name.
+		(setq name (file-name-sans-versions name))
+		;; Find first matching alist entry.
+		(while (and (not mode) alist)
+		  (if (string-match (car (car alist)) name)
+		      (setq mode (cdr (car alist))))
+		  (setq alist (cdr alist))))))))
     (if mode (funcall mode))))
 
 (defun hack-local-variables-prop-line ()