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