[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
bug#11795: 24.1.50; wdired: C-c C-c loses marks and positions of renamed files
Wed, 27 Jun 2012 19:02:47 +0100 (BST)
Michael Heerdegen <address@hidden> writes:
> But there is a problem: if I now rename a file that isn't marked, I
> get the following error:
> `dired-mark-remembered' does not accept files that are not marked, see
> the docstring. I guess this can easily be fixed by just removing
> those from the alist before calling `dired-mark-remembered'.
Here is a fix for the fix.
diff --git a/wdired.el b/wdired-fixed-fixed.el
index fe5b4ef..045fe91 100644
@@ -351,6 +351,7 @@ non-nil means return old filename."
(let ((changes nil)
+ (marks (dired-remember-marks (point-min) (point-max)))
@@ -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
+ (let ((mark (if (integerp dired-keep-marker-rename)
+ (cdr (assoc file-old marks)))))
+ (when mark
+ (push (cons (substitute-in-file-name file-new) mark)
(push (cons file-old (substitute-in-file-name file-new))
@@ -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.
+ (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