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

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Sean Whitton <spwhitton <at> spwhitton.name>,
 Spencer Baugh <sbaugh <at> janestreet.com>, Eshel Yaron <me <at> eshelyaron.com>
Cc: 79126 <at> debbugs.gnu.org
Subject: Re: bug#79126: vc-switch-working-tree does not work if there is no
 matching file
Date: Wed, 6 Aug 2025 17:37:50 +0300
On 06/08/2025 17:08, Sean Whitton wrote:
> +;; The default value works for file-visiting and Dired buffers.
> +;; Non-file-visiting major modes (other than `dired-mode'), where there
> +;; is a sensible notion of a matching buffer, can set this.
> +;; File-visiting major modes shouldn't set it, except possibly some
> +;; highly specialized ones.
> +(defvar project-find-matching-buffer-function #'project-find-matching-file
> +  "Function to switch to a matching buffer in another project.
> +Usually set buffer-locally by non-file-visiting major modes.
> +The function will be called with no arguments.  If the other project is
> +already determined, `project-current-directory-override' will be bound
> +to a directory under that other project.  Otherwise the function should
> +prompt for the other project, usually with `project-read-project'.")

How about we try to simplify that hook?

The command will check whether there is an overriding project and pass 
that value as an argument to project-find-matching-buffer-function. Or 
just the root directory, is that is simpler.

Or two arguments: current-root and new-root. That should cut the default 
function's definition by about a third, and do even better for the 
specialized ones.




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.