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


View this message in rfc822 format

From: Sean Whitton <spwhitton <at> spwhitton.name>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: sbaugh <at> janestreet.com, 79126 <at> debbugs.gnu.org
Subject: bug#79126: vc-switch-working-tree does not work if there is no matching file
Date: Tue, 05 Aug 2025 11:45:57 +0100
Hello,

On Wed 30 Jul 2025 at 03:30pm +03, Dmitry Gutov wrote:

> On 30/07/2025 14:04, Sean Whitton wrote:
>
>>> I guess some of these could be improved in project-find-matching-file (support
>>> for more major modes?) but semantically it seems like vc-switch-working-tree
>>> should try harder. Falling back to visiting the worktree root in Dired, if it
>>> doesn't find a better choice.
>> I was thinking I would implement switching between Dired directories and
>> VC-Dir buffers in project-find-matching-file, yeah.
>
> Cool, either place sounds good to me.
>
>> Maybe when the file doesn't exist we could fall back to going only as
>> high up the tree as we need to.  So for example if foo/bar.el doesn't
>> exist in the other worktree but foo/ does, invoking
>> vc-switch-working-tree would go to a dired buffer visiting foo/.
>
> Sounds reasonable.
>
>> The last resort fallback could possibly be to call project-switch-project?
>
> Probably not - it would show the prompt a second time, right?

No, I mean calling project-switch-project non-interactively and passing
it the root directory.  Then the user would get some options of exactly
what to do.

> And the last step in the algorithm from the previous paragraph would visit the
> worktree root, I think, so there shouldn't be a scenario of a complete
> failure.

True, but maybe failing all the way up to the root should be a special
case.

-- 
Sean Whitton




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.