]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/files.el (basic-save-buffer): Remove redundant directory-creation.
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 25 Feb 2013 14:29:41 +0000 (09:29 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 25 Feb 2013 14:29:41 +0000 (09:29 -0500)
lisp/ChangeLog
lisp/files.el

index d596d4f6fb14399b50a4b7dbecc59585ce0c8356..07c3df9e279a5de18897ad37e6fd7fc18fee0aba 100644 (file)
@@ -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):
index f9d02511839bdc789f5c353c74fd5837914afd06..cbc6e59c4420b0c1ddc5631b6dc78119c29698fc 100644 (file)
@@ -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