GNU bug report logs - #79126
vc-switch-working-tree does not work if there is no matching file

Previous Next

Package: emacs;

Reported by: Dmitry Gutov <dmitry <at> gutov.dev>

Date: Wed, 30 Jul 2025 02:38:01 UTC

Severity: normal

Done: Sean Whitton <spwhitton <at> spwhitton.name>

Full log


Message #32 received at 79126 <at> debbugs.gnu.org (full text, mbox):

From: Eshel Yaron <me <at> eshelyaron.com>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: Dmitry Gutov <dmitry <at> gutov.dev>, 79126 <at> debbugs.gnu.org,
 Sean Whitton <spwhitton <at> spwhitton.name>
Subject: Re: bug#79126: vc-switch-working-tree does not work if there is no
 matching file
Date: Tue, 05 Aug 2025 14:05:02 +0200
Spencer Baugh <sbaugh <at> janestreet.com> writes:

> On Tue, Aug 5, 2025, 6:47 AM Sean Whitton <spwhitton <at> spwhitton.name> wrote:
>
>  Hello,
>
>  On Wed 30 Jul 2025 at 09:41am -04, Spencer Baugh via "Bug reports for GNU Emacs, the Swiss army
>  knife of text editors" wrote:
>
>  > 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.
>
>  Ah, are you thinking they would do this by using add-function on
>  vc-switch-working-tree-function?
>
> No, just by setting that variable buffer locally.

Exactly, that'd be the usual way to use this variable.


Eshel




This bug report was last modified 5 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.