]> git.eshelyaron.com Git - emacs.git/commitdiff
Adjust thumbs to new rename-file behavior
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 11 Sep 2017 05:28:08 +0000 (22:28 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 11 Sep 2017 05:31:23 +0000 (22:31 -0700)
* etc/NEWS: Mention this.
* lisp/thumbs.el (thumbs-rename-images): Treat the destination
as special only if it is a directory name.  When there is
a marked list, turn the destination into a directory name
if it is not already.

etc/NEWS
lisp/thumbs.el

index fc40a3a55e5c9699b2d58a5d95f8acff168376c6..3f1df23ec304568656aa20f2c9beacc109f7933a 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1287,7 +1287,7 @@ can be written as (rename-file C (file-name-as-directory D)), a
 formulation portable to both older and newer versions of Emacs.
 Affected functions include add-name-to-file, copy-directory,
 copy-file, format-write-file, gnus-copy-file, make-symbolic-link,
-rename-file, and write-file.
+rename-file, thumbs-rename-images, and write-file.
 
 \f
 * Lisp Changes in Emacs 26.1
index 0665429246fb3b31e950caccb2701d985d085139..d0b5e22414afcc11138f617536091342b1fbb0a0 100644 (file)
@@ -523,23 +523,16 @@ Open another window."
   (interactive "FRename to file or directory: ")
   (let ((files (or thumbs-marked-list (list (thumbs-current-image))))
        failures)
-    (if (and (not (file-directory-p newfile))
-            thumbs-marked-list)
-       (if (file-exists-p newfile)
-           (error "Renaming marked files to file name `%s'" newfile)
-         (make-directory newfile t)))
+    (when thumbs-marked-list
+      (make-directory newfile t)
+      (setq newfile (file-name-as-directory newfile)))
     (if (yes-or-no-p (format "Really rename %d files? " (length files)))
        (let ((thumbs-file-list (thumbs-file-alist))
              (inhibit-read-only t))
          (dolist (file files)
            (let (failure)
              (condition-case ()
-                 (if (file-directory-p newfile)
-                     (rename-file file
-                                  (expand-file-name
-                                   (file-name-nondirectory file)
-                                   newfile))
-                   (rename-file file newfile))
+                 (rename-file file newfile)
                (file-error (setq failure t)
                            (push file failures)))
              (unless failure