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 02:27:00 +0100 (BST)

Michael Heerdegen <address@hidden> writes:

> Background: `wdired-finish-edit' calls `revert-buffer', which will
> call `dired-revert'.  Before this is called, everything is ok.  But
> `dired-revert' fails to remember the mark and the position of the
> renamed file correctly.  I didn't dig any further, but I guess a
> specialized revert function is needed for `wdired-finish-edit'.

This patch for wdired.el fixes the problem here (GNU Emacs 24.1.1).
diff --git a/wdired.el b/wdired-fixed.el
index fe5b4ef..d241d2e 100644
--- a/wdired.el
+++ b/wdired-fixed.el
@@ -350,7 +350,8 @@ non-nil means return old filename."
   (interactive)
   (wdired-change-to-dired-mode)
   (let ((changes nil)
-       (errors 0)
+       (errors 0)      
+       (marks (dired-remember-marks (point-min) (point-max)))
        files-deleted
        files-renamed
        some-file-names-unchanged
@@ -376,6 +377,9 @@ non-nil means return old filename."
             (setq changes t)
             (if (not file-new)         ;empty filename!
                 (push file-old files-deleted)
+             (push (cons (substitute-in-file-name file-new)
+                         (cdr (assoc file-old marks)))
+                   marks)
               (push (cons file-old (substitute-in-file-name file-new))
                     files-renamed))))
        (forward-line -1)))
@@ -393,7 +397,8 @@ 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)
+         (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]