+2007-03-20 Martin Rudalics <rudalics@gmx.at>
+
+ * files.el (basic-save-buffer): Do not set visited filename when
+ the corresponding directory does not exist or the specified
+ filename is that of an existing directory.
+
2007-03-20 Glenn Morris <rgm@gnu.org>
* calendar/diary-lib.el (diary-live-p): New function.
(rcirc-nick-prefix-chars): Add variable.
(rcirc-user-nick): Use above variable.
-2007-03-10 Johan Bockg\e,be\e(Brd <bojohan@dd.chalmers.se>
+2007-03-10 Johan Bockg\e,Ae\e(Brd <bojohan@dd.chalmers.se>
* icomplete.el (icomplete-tidy, icomplete-exhibit):
Bind deactivate-mark to nil.
(let ((filename
(expand-file-name
(read-file-name "File to save in: ") nil)))
- (and (file-exists-p filename)
- (or (y-or-n-p (format "File `%s' exists; overwrite? "
- filename))
- (error "Canceled")))
+ (if (file-exists-p filename)
+ (if (file-directory-p filename)
+ ;; Signal an error if the user specified the name of an
+ ;; existing directory.
+ (error "%s is a directory" filename)
+ (unless (y-or-n-p (format "File `%s' exists; overwrite? "
+ filename))
+ (error "Canceled")))
+ ;; Signal an error if the specified name refers to a
+ ;; non-existing directory.
+ (let ((dir (file-name-directory filename)))
+ (unless (file-directory-p dir)
+ (if (file-exists-p dir)
+ (error "%s is not a directory" dir)
+ (error "%s: no such directory" dir)))))
(set-visited-file-name filename)))
(or (verify-visited-file-modtime (current-buffer))
(not (file-exists-p buffer-file-name))