1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

New command vc-kill-other-working-tree-buffers

* lisp/vc/vc.el (vc-kill-other-working-tree-buffers): New
command.
* lisp/vc/vc-hooks.el (vc-prefix-map): Bind it.
* doc/emacs/vc1-xtra.texi (Other Working Trees):
* etc/NEWS: Document it.
This commit is contained in:
Sean Whitton 2025-10-01 20:51:57 +01:00
parent 889ae269b0
commit b5cf0786a2
5 changed files with 35 additions and 2 deletions

View file

@ -968,6 +968,7 @@ In the latter case, VC mode is deactivated for this buffer."
"!" #'vc-edit-next-command
"w c" #'vc-add-working-tree
"w w" #'vc-switch-working-tree
"w k" #'vc-kill-other-working-tree-buffers
"w s" #'vc-working-tree-switch-project
"w x" #'vc-delete-working-tree
"w R" #'vc-move-working-tree

View file

@ -4886,6 +4886,24 @@ MOVE non-nil means to move instead of copy."
(message "Changes %s to `%s'"
(if move "moved" "applied") directory)))
;;;###autoload
(defun vc-kill-other-working-tree-buffers (backend)
"Kill buffers visiting versions of this file in other working trees.
BACKEND is the VC backend.
This command kills the buffers that \\[vc-switch-working-tree] switches to,
except that this command works only in file-visiting buffers."
(interactive (list (vc-responsible-backend default-directory)))
(when (cdr uniquify-managed)
(cl-loop with trees = (vc-call-backend backend
'known-other-working-trees)
for item in uniquify-managed
for buf = (uniquify-item-buffer item)
when (and (not (eq buf (current-buffer)))
(cl-find (uniquify-item-dirname item) trees
:test #'file-in-directory-p))
do (kill-buffer buf))))
(defun vc-default-cherry-pick-comment (files rev reverse)
(if reverse (format "Summary: Reverse-apply changes from revision %s\n\n"
rev)