Commit 8400146f authored by Martin Rudalics's avatar Martin Rudalics
Browse files

(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.
parent 87f4728f
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.
......@@ -189,7 +195,7 @@
(rcirc-nick-prefix-chars): Add variable.
(rcirc-user-nick): Use above variable.
 
2007-03-10 Johan Bockg,be(Brd <bojohan@dd.chalmers.se>
2007-03-10 Johan Bockg,Ae(Brd <bojohan@dd.chalmers.se>
 
* icomplete.el (icomplete-tidy, icomplete-exhibit):
Bind deactivate-mark to nil.
......@@ -3595,10 +3595,21 @@ Before and after saving the buffer, this function runs
(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))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment