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 #53 received at 79126 <at> debbugs.gnu.org (full text, mbox):

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

On Wed 06 Aug 2025 at 06:15pm +02, Eshel Yaron wrote:

> Hi,
>
> Sean Whitton <spwhitton <at> spwhitton.name> writes:
>
>> Hello,
>>
>> Thank you all for the comments.  Please find attached an implementation.
>
> [...]
>
>> From a458eb6a117408821c7ec304c7bef60cf4a544ab Mon Sep 17 00:00:00 2001
>> From: Sean Whitton <spwhitton <at> spwhitton.name>
>> Date: Wed, 6 Aug 2025 15:05:08 +0100
>> Subject: [PATCH] Generalize project-find-matching-file to other major modes
>>
>> * lisp/progmodes/project.el (dired-current-directory): Declare.
>> (project-find-matching-file): Handle Dired buffers (bug#79126).
>
> Any good reason to special-case Dired?  Wouldn't it be nicer to have
> Dired set project-find-matching-buffer-function appropriately, as I do
> in my implementation with vc-switch-working-tree-function? :)

Heh.  I tried that first, but found myself duplicating code, so decided
that folding it into project-find-matching-file was neatest.

> [...]
>
>> +                               (dirp (dired-current-directory))
>
> I don't think dired-current-directory is the right choice here.  It does
> the wrong thing when point is in a subdir added with 'i' (it gives you
> the subdir, not the dir of the current buffer).

This was deliberate.  To me it seems desirable to look for the matching
subdirectory.  Sounds like you disagree?

-- 
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.