]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/wdired.el: Revert 2012-10-17 change partly and replace it with
authorJuri Linkov <juri@jurta.org>
Fri, 23 Nov 2012 07:28:37 +0000 (09:28 +0200)
committerJuri Linkov <juri@jurta.org>
Fri, 23 Nov 2012 07:28:37 +0000 (09:28 +0200)
Patch by Christopher Schmidt <christopher@ch.ristopher.com>.
(wdired-finish-edit): Add marks for new file names to
`wdired-old-marks'.  Restore marks using `dired-mark-remembered'
after `revert-buffer'.
(wdired-do-renames): Remove calls to `dired-remove-file',
`dired-add-file', `dired-add-entry'.

Fixes: debbugs:11795
lisp/ChangeLog
lisp/wdired.el

index e0f671882272ebd3a8e2503eac1de7e1ae0709ac..6222c9d0237fdcd9422c7bc079b2d2fecc625c57 100644 (file)
@@ -1,3 +1,13 @@
+2012-11-23  Juri Linkov  <juri@jurta.org>
+
+       * wdired.el: Revert 2012-10-17 change partly and replace it with
+       Patch by Christopher Schmidt <christopher@ch.ristopher.com>.
+       (wdired-finish-edit): Add marks for new file names to
+       `wdired-old-marks'.  Restore marks using `dired-mark-remembered'
+       after `revert-buffer'.
+       (wdired-do-renames): Remove calls to `dired-remove-file',
+       `dired-add-file', `dired-add-entry'.  (Bug#11795)
+
 2012-11-21  Alan Mackenzie  <acm@muc.de>
 
        * progmodes/cc-defs.el (c-version): Bump to 5.32.4.
index 9851b2046d9ed31ec515e1f8f90939d0b93cc720..5183b5639c3aeb610fd4ff5e0575785d8825cdd5 100644 (file)
@@ -399,6 +399,15 @@ non-nil means return old filename."
             (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 +425,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 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 +441,6 @@ non-nil means return old filename."
   (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 +482,7 @@ non-nil means return old filename."
               (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 +493,12 @@ non-nil means return old filename."
               (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))