Subject: bug#78890: 31.0.50; Messy vc-annotate buffer names

From: Jim Porter <[email-masked]>
Date: Thu, 26 Jun 2025 09:54:00 -0700

On 6/26/2025 8:06 AM, Sean Whitton wrote:
> Removing vc-ensure-vc-buffer was intentional, and it shouldn't just go
> back -- that was part of adding vc-buffer-overriding-fileset.  What do
> you both think to something like this:

One small issue I noticed: if you kill the original buffer, then 
'file-buffer' will be nil and we fall back to using 'file' when naming 
the Annotate buffer. We should probably just use the nondirectory part 
of file though. Otherwise, we'd display the absolute filename in the 
Annotate buffer name. Something like this patch:

----------------------------------------

diff --git a/lisp/vc/vc-annotate.el b/lisp/vc/vc-annotate.el
index de432e4e1c3..d0077af4db9 100644
--- a/lisp/vc/vc-annotate.el
+++ b/lisp/vc/vc-annotate.el
@@ -419,7 +419,12 @@ vc-annotate
                        (read-string (format-prompt "Annotate span days" 20)
                                     nil nil "20"))))))))
    (setq vc-annotate-display-mode display-mode) ;Not sure why.  --Stef
-  (let* ((temp-buffer-name (format "*Annotate %s (rev %s)*" 
(buffer-name) rev))
+  (let* ((file-buffer (get-file-buffer file))
+         (temp-buffer-name (format "*Annotate %s (rev %s)*"
+                                   (if file-buffer
+                                       (buffer-name file-buffer)
+                                     (file-name-nondirectory file))
+                                   rev))
           (temp-buffer-show-function 'vc-annotate-display-select)
           ;; If BUF is specified, we presume the caller maintains 
current line,
           ;; so we don't need to do it here.  This implementation may give