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)))
|
(let ((from (expand-file-name from)))
|
||||||
(dired-rename-subdir from (expand-file-name to))
|
(dired-rename-subdir from (expand-file-name to))
|
||||||
(dolist (buf vc-dir-buffers)
|
(dolist (buf vc-dir-buffers)
|
||||||
(with-current-buffer buf
|
(when (buffer-live-p buf)
|
||||||
(when (string-prefix-p from default-directory)
|
(with-current-buffer buf
|
||||||
(setq default-directory
|
(when (string-prefix-p from default-directory)
|
||||||
(expand-file-name (file-relative-name default-directory from)
|
(setq default-directory
|
||||||
to))
|
(expand-file-name (file-relative-name default-directory from)
|
||||||
;; Obtain an appropriately uniquify'd name for a *vc-dir*
|
to))
|
||||||
;; buffer in the new working tree. In particular if this
|
;; If the *vc-dir* buffer has a uniquify'd name then we need
|
||||||
;; *vc-dir* buffer already has a uniquify'd name appropriate
|
;; to obtain an new uniquify'd name for this buffer under
|
||||||
;; for the old working tree, we must replace that.
|
;; the new working tree, replacing the one for the old
|
||||||
;; See also `vc-dir-prepare-status-buffer'.
|
;; working tree. See also `vc-dir-prepare-status-buffer'.
|
||||||
;; FIXME: There should be a way to get this information
|
(when-let* ((base-name (uniquify-buffer-base-name))
|
||||||
;; without creating and killing a buffer.
|
(item (cl-find (current-buffer) uniquify-managed
|
||||||
(let (name)
|
:key #'uniquify-item-buffer)))
|
||||||
(unwind-protect
|
(let (name)
|
||||||
(setq name (buffer-name
|
;; FIXME: There should be a way to get this information
|
||||||
(create-file-buffer
|
;; without creating and killing a buffer.
|
||||||
(expand-file-name "*vc-dir*"
|
(unwind-protect
|
||||||
default-directory))))
|
(setq name (buffer-name
|
||||||
(kill-buffer name))
|
(create-file-buffer
|
||||||
(rename-buffer name))))))
|
(expand-file-name base-name
|
||||||
|
default-directory))))
|
||||||
|
(kill-buffer name))
|
||||||
|
(uniquify-rename-buffer item name))))))))
|
||||||
|
|
||||||
(when-let* ((p (project-current nil to)))
|
(when-let* ((p (project-current nil to)))
|
||||||
(project-remember-project p)))
|
(project-remember-project p)))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue