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>, Spencer Baugh <sbaugh <at> janestreet.com>, Eshel Yaron <me <at> eshelyaron.com>
Cc: 79126 <at> debbugs.gnu.org
Subject: bug#79126: vc-switch-working-tree does not work if there is no matching file
Date: Wed, 06 Aug 2025 15:08:17 +0100
[Message part 1 (text/plain, inline)]
Hello,

Thank you all for the comments.  Please find attached an implementation.

On Tue 05 Aug 2025 at 03:30pm +03, Dmitry Gutov wrote:

> On 05/08/2025 13:45, Sean Whitton wrote:
>>>> 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.
>
> Adhering to project-switch-commands might be a fine idea, indeed. Although I'd
> probably prefer to just use Dired, myself.

Skipped that idea for now.

>>> 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.
>
> Semantically, just going by the command's name, it seems to me that switching
> to a different directory is the key part of its behavior, and finding a
> corresponding file - a secondary one.
>
> Perhaps we'll want to add a command called 'vc-worktree-find-matching-file'?

I've done it within project-find-matching-file for now but am certainly
open to renaming that function or moving things around -- let me know
what you think.

-- 
Sean Whitton
[0001-Generalize-project-find-matching-file-to-other-major.patch (text/x-diff, attachment)]

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.