mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-23 07:19:15 +00:00
* lisp/files.el (basic-save-buffer): Remove redundant directory-creation.
This commit is contained in:
parent
ce9ae7ca92
commit
944c37effa
@ -1,3 +1,7 @@
|
||||
2013-02-25 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* files.el (basic-save-buffer): Remove redundant directory-creation.
|
||||
|
||||
2013-02-24 Jay Belanger <jay.p.belanger@gmail.com>
|
||||
|
||||
* calc/calc-ext.el (math-to-radians-2, math-from-radians-2):
|
||||
|
@ -4563,32 +4563,21 @@ Before and after saving the buffer, this function runs
|
||||
(not (file-exists-p buffer-file-name))))
|
||||
(let ((recent-save (recent-auto-save-p))
|
||||
setmodes)
|
||||
;; If buffer has no file name, ask user for one.
|
||||
;; If buffer has no file name, ask user for one.
|
||||
(or buffer-file-name
|
||||
(let ((filename
|
||||
(expand-file-name
|
||||
(read-file-name "File to save in: "
|
||||
nil (expand-file-name (buffer-name))))))
|
||||
(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)
|
||||
(if (y-or-n-p
|
||||
(format "Directory `%s' does not exist; create? "
|
||||
dir))
|
||||
(make-directory dir t)
|
||||
(error "Canceled"))))))
|
||||
(set-visited-file-name filename)))
|
||||
(let ((filename
|
||||
(expand-file-name
|
||||
(read-file-name "File to save in: "
|
||||
nil (expand-file-name (buffer-name))))))
|
||||
(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"))))
|
||||
(set-visited-file-name filename)))
|
||||
(or (verify-visited-file-modtime (current-buffer))
|
||||
(not (file-exists-p buffer-file-name))
|
||||
(yes-or-no-p
|
||||
|
Loading…
Reference in New Issue
Block a user