[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: |
Juri Linkov |
Subject: |
bug#11795: 24.1.50; wdired: C-c C-c loses marks and positions of renamed files |
Date: |
Thu, 22 Nov 2012 11:12:12 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) |
reopen 11795
stop
This bug is a regression against Emacs 23.1+.
Actually I found out that Christopher already proposed a patch
that fixes this bug. I see no reason not to use it. I propose
to do this on the Emacs-24 release branch before the pretest:
to revert the ill-behaved part of revno:110564 and install
Christopher's patch that works correctly in my tests and
has no bad effects caused by unnecessary direct operations
on the dired buffer.
Below is a complete patch adapted for the Emacs-24 release branch:
=== modified file 'lisp/wdired.el'
--- lisp/wdired.el 2012-10-27 09:17:14 +0000
+++ lisp/wdired.el 2012-11-22 09:09:30 +0000
@@ -399,6 +397,15 @@ (defun wdired-finish-edit ()
(setq changes t)
(if (not file-new) ;empty filename!
(push file-old files-deleted)
+ (when wdired-keep-marker-rename
+ (let ((mark (cond ((integerp wdired-keep-marker-rename)
+ wdired-keep-marker-rename)
+ (wdired-keep-marker-rename
+ (cdr (assoc file-old wdired-old-marks)))
+ (t nil))))
+ (when mark
+ (push (cons (substitute-in-file-name file-new) mark)
+ wdired-old-marks))))
(push (cons file-old (substitute-in-file-name file-new))
files-renamed))))
(forward-line -1)))
@@ -416,7 +423,9 @@ (defun wdired-finish-edit ()
(= (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 wdired-old-marks)))
(let ((inhibit-read-only t))
(remove-text-properties (point-min) (point-max)
'(old-name nil end-name nil old-link nil
@@ -430,8 +439,6 @@ (defun wdired-finish-edit ()
(set-buffer-modified-p nil)
(setq buffer-undo-list nil))
-(declare-function dired-add-entry "dired-aux" (filename &optional marker-char
relative))
-
(defun wdired-do-renames (renames)
"Perform RENAMES in parallel."
(let ((residue ())
@@ -473,8 +480,7 @@ (defun wdired-do-renames (renames)
(push (cons tmp file-new) residue))))
(t
(setq progress t)
- (let* ((file-ori (car rename))
- (old-mark (cdr (assoc file-ori wdired-old-marks))))
+ (let* ((file-ori (car rename)))
(if wdired-use-interactive-rename
(wdired-search-and-rename file-ori file-new)
;; If dired-rename-file autoloads dired-aux while
@@ -485,20 +491,12 @@ (defun wdired-do-renames (renames)
(condition-case err
(let ((dired-backup-overwrite nil))
(dired-rename-file file-ori file-new
- overwrite)
- (dired-remove-file file-ori)
- (dired-add-file
- file-new
- (cond ((integerp wdired-keep-marker-rename)
- wdired-keep-marker-rename)
- (wdired-keep-marker-rename old-mark)
- (t nil))))
+ overwrite))
(error
(setq errors (1+ errors))
(dired-log (concat "Rename `" file-ori "' to `"
file-new "' failed:\n%s\n")
- err)
- (dired-add-entry file-ori old-mark)))))))))
+ err)))))))))
errors))
- bug#11795: 24.1.50; wdired: C-c C-c loses marks and positions of renamed files,
Juri Linkov <=