mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
Fix wdired with (dired '(dir f1 f2 ...))
* lisp/wdired.el (wdired-finish-edit): Fix wdired with (dired '(dir f1 f2 ...)) (bug#57334).
This commit is contained in:
parent
e2c766a20d
commit
66040fbeed
1 changed files with 22 additions and 9 deletions
|
|
@ -537,15 +537,28 @@ non-nil means return old filename."
|
|||
(wdired-change-to-dired-mode)
|
||||
(if changes
|
||||
(progn
|
||||
;; If we are displaying a single file (rather than the
|
||||
;; contents of a directory), change dired-directory if that
|
||||
;; file was renamed. (This ought to be generalized to
|
||||
;; handle the multiple files case, but that's less trivial).
|
||||
(when (and (stringp dired-directory)
|
||||
(cond
|
||||
((and (stringp dired-directory)
|
||||
(not (file-directory-p dired-directory))
|
||||
(null some-file-names-unchanged)
|
||||
(= (length files-renamed) 1))
|
||||
;; If we are displaying a single file (rather than the
|
||||
;; contents of a directory), change dired-directory if that
|
||||
;; file was renamed.
|
||||
(setq dired-directory (cdr (car files-renamed))))
|
||||
((and (consp dired-directory)
|
||||
(cdr dired-directory)
|
||||
files-renamed)
|
||||
;; Fix dired buffers created with
|
||||
;; (dired '(foo f1 f2 f3)).
|
||||
(setq dired-directory
|
||||
(cons (car dired-directory)
|
||||
;; Replace in `dired-directory' files that have
|
||||
;; been modified with their new name keeping
|
||||
;; the ones that are unmodified at the same place.
|
||||
(cl-loop for f in (cdr dired-directory)
|
||||
collect (or (assoc-default f files-renamed)
|
||||
f))))))
|
||||
;; Re-sort the buffer.
|
||||
(revert-buffer)
|
||||
(let ((inhibit-read-only t))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue