emacs-diffs
[Top][All Lists]
Advanced

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

master a65ece8b201: Fix Wdired with relative and abbreviated file names


From: Eli Zaretskii
Subject: master a65ece8b201: Fix Wdired with relative and abbreviated file names
Date: Sun, 16 Jul 2023 05:16:00 -0400 (EDT)

branch: master
commit a65ece8b2011bd69922262a6fbcf68c2e2c2a717
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix Wdired with relative and abbreviated file names
    
    * lisp/wdired.el (wdired-finish-edit): Support Dired buffers where
    'dired-directory' is a list made of relative or abbreviated file
    names.  (Bug#64606)
---
 lisp/wdired.el | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/lisp/wdired.el b/lisp/wdired.el
index 5c745cc9aab..7b9c75d36b1 100644
--- a/lisp/wdired.el
+++ b/lisp/wdired.el
@@ -556,8 +556,24 @@ non-nil means return old filename."
                         ;; been modified with their new name keeping
                         ;; the ones that are unmodified at the same place.
                         (cl-loop for f in (cdr dired-directory)
-                                 collect (or (assoc-default f files-renamed)
-                                             f))))))
+                                 collect
+                                 (or (assoc-default f files-renamed)
+                                     ;; F could be relative or
+                                     ;; abbreviated, whereas
+                                     ;; files-renamed always consists
+                                     ;; of absolute file names.
+                                     (let ((relative
+                                            (not (file-name-absolute-p f)))
+                                           (match
+                                            (assoc-default (expand-file-name f)
+                                                           files-renamed)))
+                                       (cond
+                                        ;; If it was relative, convert
+                                        ;; the new name back to relative.
+                                        ((and match relative)
+                                         (file-relative-name match))
+                                        (t match)))
+                                     f))))))
          ;; Re-sort the buffer.
          (revert-buffer)
          (let ((inhibit-read-only t))



reply via email to

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