changeset 18819:881a46c98ddf

(set-auto-mode): If -*- line specifies a mode, then even if we don't use it because of just-from-file-name, still let it prevent taking the mode from a file name. (basic-save-buffer-1): Clarify error message. (cd-absolute): Likewise.
author Richard M. Stallman <rms@gnu.org>
date Wed, 16 Jul 1997 05:30:34 +0000
parents 3c0dec827888
children ac2b130c513a
files lisp/files.el
diffstat 1 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/files.el	Wed Jul 16 05:29:01 1997 +0000
+++ b/lisp/files.el	Wed Jul 16 05:30:34 1997 +0000
@@ -397,7 +397,9 @@
       (setq dir (file-name-as-directory dir)))
   (setq dir (abbreviate-file-name (expand-file-name dir)))
   (if (not (file-directory-p dir))
-      (error "%s is not a directory" dir)
+      (if (file-exists-p dir)
+	  (error "%s is not a directory" dir)
+	(error "%s: no such directory"))
     (if (file-executable-p dir)
 	(setq default-directory dir)
       (error "Cannot cd to %s:  Permission denied" dir))))
@@ -1284,10 +1286,10 @@
 				 modes))))))
     ;; If we found modes to use, invoke them now,
     ;; outside the save-excursion.
-    (if modes
-	(unless just-from-file-name
-	  (mapcar 'funcall (nreverse modes))
-	  (setq done t)))
+    (when modes
+      (unless just-from-file-name
+	(mapcar 'funcall (nreverse modes)))
+      (setq done t))
     ;; If we didn't find a mode from a -*- line, try using the file name.
     (if (and (not done) buffer-file-name)
 	(let ((name buffer-file-name)
@@ -2135,7 +2137,9 @@
     (if (not (file-writable-p buffer-file-name))
 	(let ((dir (file-name-directory buffer-file-name)))
 	  (if (not (file-directory-p dir))
-	      (error "%s is not a directory" dir)
+	      (if (file-exists-p dir)
+		  (error "%s is not a directory" dir)
+		(error "%s: no such directory"))
 	    (if (not (file-exists-p buffer-file-name))
 		(error "Directory %s write-protected" dir)
 	      (if (yes-or-no-p