Subject: bug#77306: 31.0.50; C-x v L from *vc-change-log* buffer leaves wrong default-directory

From: Dmitry Gutov <[email-masked]>
Date: Thu, 3 Apr 2025 15:14:28 +0300

On 27/03/2025 13:13, Sean Whitton wrote:
> This problem is caused by the let binding of default-directory
> established by vc-print-root-log.  vc-setup-buffer wants to set
> default-directory in the*vc-change-log* buffer to the new repository's
> root, but ends up just adjusting the let binding's value.
> 
> The same thing probably occurs with C-x v D.
> 
> Could we reformulate the command definitions so that they didn't need to
> bind default-directory?  Should vc-setup-buffer use the same
> run-with-timer trick implemented in xref--ensure-default-directory?

Yeah, I don't have a better suggestion.

The key here seem to be that the buffer already exists and is selected 
when the command is invoked. Perhaps we could recreate the buffer 
instead of reusing it? But then we'd also need to put it in the same 
window, fixup the buffer list to use the same position, and etc...