From 83c6f446502050a47a001f5c21d0cf06e7a86352 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 16 Jul 1997 05:30:34 +0000 Subject: [PATCH] (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. --- lisp/files.el | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index d2557e4bee7..c241661447a 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -397,7 +397,9 @@ Not actually set up until the first time you you use it.") (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 @@ and we don't even do that unless it would come from the file name." 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 @@ After saving the buffer, run `after-save-hook'." (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 -- 2.39.2