From: Stefan Monnier Date: Mon, 25 Feb 2013 14:29:41 +0000 (-0500) Subject: * lisp/files.el (basic-save-buffer): Remove redundant directory-creation. X-Git-Tag: emacs-24.3.90~173^2~6^2~46 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=944c37effa068de90af84c37106461bca3076bea;p=emacs.git * lisp/files.el (basic-save-buffer): Remove redundant directory-creation. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d596d4f6fb1..07c3df9e279 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2013-02-25 Stefan Monnier + + * files.el (basic-save-buffer): Remove redundant directory-creation. + 2013-02-24 Jay Belanger * calc/calc-ext.el (math-to-radians-2, math-from-radians-2): diff --git a/lisp/files.el b/lisp/files.el index f9d02511839..cbc6e59c442 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -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