summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-07-16 05:30:34 +0000
committerRichard M. Stallman <rms@gnu.org>1997-07-16 05:30:34 +0000
commite835453490e2ba5cb505bd910a6fc16e5ad3d9d4 (patch)
treed625ad83950695294345c38755da2f5d6d7f11ca
parent1e6f3aef8d8ce7482a6877415e6e4ba3c93d5820 (diff)
downloademacs-e835453490e2ba5cb505bd910a6fc16e5ad3d9d4.tar.gz
(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.
-rw-r--r--lisp/files.el16
1 files 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