emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 2aa0288 5/5: Adjust thumbs to new rename-file behav


From: Paul Eggert
Subject: [Emacs-diffs] master 2aa0288 5/5: Adjust thumbs to new rename-file behavior
Date: Mon, 11 Sep 2017 01:31:31 -0400 (EDT)

branch: master
commit 2aa028825920207cca2bacb581111ab780e5d9ee
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Adjust thumbs to new rename-file behavior
    
    * 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       |  2 +-
 lisp/thumbs.el | 15 ++++-----------
 2 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index fc40a3a..3f1df23 100644
--- 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.
 
 
 * Lisp Changes in Emacs 26.1
diff --git a/lisp/thumbs.el b/lisp/thumbs.el
index 0665429..d0b5e22 100644
--- a/lisp/thumbs.el
+++ b/lisp/thumbs.el
@@ -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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]