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: 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: bug#79126: vc-switch-working-tree does not work if there is no matching file
Date: Fri, 8 Aug 2025 03:35:05 +0300
On 07/08/2025 15:38, Sean Whitton wrote:
> Thanks again all.  Here's the revised patch.

Nice! Looking good.

> +;; 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-or-directory
> +  "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 two arguments, the project instance for
> +this buffer's project, and the project instance for the matching buffer.")

I suggest to try to get more of the info from the comment into the 
docstring.

> +         (dirp (derived-mode-p 'dired-mode))

One more thing to try is not to specialize on Dired mode: and default to 
assuming that any buffer without buffer-file-name is "dirp". The default 
implementation would either find/create a Dired buffer in the same dir, 
or even search through the buffer list for a buffer with matching values 
of major-mode and default-directory.

This is optional, just something that came to mind.




This bug report was last modified 6 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.