GNU bug report logs -
#79126
vc-switch-working-tree does not work if there is no matching file
Previous Next
Full log
Message #20 received at 79126 <at> debbugs.gnu.org (full text, mbox):
Sean Whitton <spwhitton <at> spwhitton.name> writes:
> Hello,
>
> On Wed 30 Jul 2025 at 06:30am +02, Eshel Yaron wrote:
>
>> FWIW, while incorporating this new feature in my Emacs branch, I've made
>> a few experimental tweaks that eliminate these errors. Namely, I added
>> a variable vc-switch-working-tree-function which vc-switch-working-tree
>> consults to do the actual switching. By default this variable is set to
>> a function that works for file-visiting buffers (similarly to the
>> current implementation in master), but major modes can readily set this
>> variable buffer-locally to provide worktree-switching support also for
>> non-file buffers. I used this indirection to support Dired buffers.
>
> Interesting, though it seems to me that instead of adding a whole new
> variable vc-switch-working-tree-function, someone could just write a
> custom command and bind that to 'C-x v w w'? Wouldn't that pretty much
> cover it?
No, because multiple other packages providing special buffers might want
to integrate with the existing C-x v w w command.
This sounds like a great idea to me, seems like it would be pretty nice.
For example, we might want:
- C-x v w w while in vc-dir brings you to vc-dir in the other worktree
- C-x v w w while in project-eshell brings you to project-eshell in the
other worktree
- C-x v w w while in magit-status brings you to magit-status in the other
worktree
Also, at my site there is a custom "worktree/branch overview" buffer and
it would be great if it was possible to make C-x v w w switch to the
overview buffer for the other worktree.
This bug report was last modified 6 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.