1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

* lisp/files.el (basic-save-buffer): Move check for existing parent directory

after hooks.  (Bug#13773)
This commit is contained in:
Glenn Morris 2013-02-20 21:44:06 -05:00
parent 2fce4cd861
commit b367ec7bc1
2 changed files with 14 additions and 9 deletions

View file

@ -1,3 +1,8 @@
2013-02-21 Glenn Morris <rgm@gnu.org>
* files.el (basic-save-buffer): Move check for existing parent
directory after hooks. (Bug#13773)
2013-02-20 Stefan Monnier <monnier@iro.umontreal.ca>
* simple.el (command-execute): Move from C. Add obsolete check.

View file

@ -4563,15 +4563,8 @@ 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-file-name
(let ((dir (file-name-directory
(expand-file-name buffer-file-name))))
(unless (file-exists-p dir)
(if (y-or-n-p
(format "Directory `%s' does not exist; create? " dir))
(make-directory dir t)
(error "Canceled"))))
;; 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: "
@ -4628,7 +4621,14 @@ Before and after saving the buffer, this function runs
(run-hook-with-args-until-success 'write-file-functions)
;; If a hook returned t, file is already "written".
;; Otherwise, write it the usual way now.
(setq setmodes (basic-save-buffer-1)))
(let ((dir (file-name-directory
(expand-file-name buffer-file-name))))
(unless (file-exists-p dir)
(if (y-or-n-p
(format "Directory `%s' does not exist; create? " dir))
(make-directory dir t)
(error "Canceled")))
(setq setmodes (basic-save-buffer-1))))
;; Now we have saved the current buffer. Let's make sure
;; that buffer-file-coding-system is fixed to what
;; actually used for saving by binding it locally.