bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#11795: 24.1.50; wdired: C-c C-c loses marks and positions of renamed


From: Christopher Schmidt
Subject: bug#11795: 24.1.50; wdired: C-c C-c loses marks and positions of renamed files
Date: Wed, 27 Jun 2012 15:47:18 +0100 (BST)

"Drew Adams" <address@hidden> writes:

>> This patch for wdired.el fixes the problem here (GNU Emacs 24.1.1).
>
> But shouldn't Wdired respect the user's setting of option
> `dired-keep-marker-rename'?  IOW, shouldn't users be able to control
> whether exiting wdired removes marks?

Right.
diff --git a/wdired.el b/wdired-fixed.el
index fe5b4ef..c5956c5 100644
--- a/wdired.el
+++ b/wdired-fixed.el
@@ -351,6 +351,7 @@ non-nil means return old filename."
   (wdired-change-to-dired-mode)
   (let ((changes nil)
        (errors 0)
+       (marks (dired-remember-marks (point-min) (point-max)))
        files-deleted
        files-renamed
        some-file-names-unchanged
@@ -376,6 +377,12 @@ non-nil means return old filename."
             (setq changes t)
             (if (not file-new)         ;empty filename!
                 (push file-old files-deleted)
+             (when dired-keep-marker-rename
+               (push (cons (substitute-in-file-name file-new)
+                           (if (integerp dired-keep-marker-rename)
+                               dired-keep-marker-rename
+                             (cdr (assoc file-old marks))))
+                     marks))
               (push (cons file-old (substitute-in-file-name file-new))
                     files-renamed))))
        (forward-line -1)))
@@ -393,7 +400,9 @@ non-nil means return old filename."
                     (= (length files-renamed) 1))
            (setq dired-directory (cdr (car files-renamed))))
          ;; Re-sort the buffer.
-         (revert-buffer))
+         (revert-buffer)
+         (let ((inhibit-read-only t))
+           (dired-mark-remembered marks)))
       (let ((inhibit-read-only t))
        (remove-text-properties (point-min) (point-max)
                                '(old-name nil end-name nil old-link nil
        Christopher

reply via email to

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