mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
vc-move-working-tree: Improve updating VC-Dir buffers
* lisp/vc/vc.el (vc-move-working-tree): Check entries in vc-dir-buffers for liveness. Don't hardcode "*vc-dir*"; instead call uniquify-buffer-base-name. Call uniquify-rename-buffer, not rename-buffer, so that the buffer is not marked unmanaged.
This commit is contained in:
parent
c05ea64d82
commit
6ffa926f90
1 changed files with 23 additions and 20 deletions
|
|
@ -4489,26 +4489,29 @@ BACKEND is the VC backend."
|
|||
(let ((from (expand-file-name from)))
|
||||
(dired-rename-subdir from (expand-file-name to))
|
||||
(dolist (buf vc-dir-buffers)
|
||||
(when (buffer-live-p buf)
|
||||
(with-current-buffer buf
|
||||
(when (string-prefix-p from default-directory)
|
||||
(setq default-directory
|
||||
(expand-file-name (file-relative-name default-directory from)
|
||||
to))
|
||||
;; Obtain an appropriately uniquify'd name for a *vc-dir*
|
||||
;; buffer in the new working tree. In particular if this
|
||||
;; *vc-dir* buffer already has a uniquify'd name appropriate
|
||||
;; for the old working tree, we must replace that.
|
||||
;; See also `vc-dir-prepare-status-buffer'.
|
||||
;; If the *vc-dir* buffer has a uniquify'd name then we need
|
||||
;; to obtain an new uniquify'd name for this buffer under
|
||||
;; the new working tree, replacing the one for the old
|
||||
;; working tree. See also `vc-dir-prepare-status-buffer'.
|
||||
(when-let* ((base-name (uniquify-buffer-base-name))
|
||||
(item (cl-find (current-buffer) uniquify-managed
|
||||
:key #'uniquify-item-buffer)))
|
||||
(let (name)
|
||||
;; FIXME: There should be a way to get this information
|
||||
;; without creating and killing a buffer.
|
||||
(let (name)
|
||||
(unwind-protect
|
||||
(setq name (buffer-name
|
||||
(create-file-buffer
|
||||
(expand-file-name "*vc-dir*"
|
||||
(expand-file-name base-name
|
||||
default-directory))))
|
||||
(kill-buffer name))
|
||||
(rename-buffer name))))))
|
||||
(uniquify-rename-buffer item name))))))))
|
||||
|
||||
(when-let* ((p (project-current nil to)))
|
||||
(project-remember-project p)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue