1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

vc-annotate: Fix ever-lengthening buffer names

* lisp/vc/vc-annotate.el (vc-annotate): Rewrite code to generate
the buffer name so that when switching from annotating one
revision to annotating another, we don't embed the old name of
the vc-annotate buffer directly into its new one (bug#78890).
This commit is contained in:
Sean Whitton 2025-06-27 21:19:55 +01:00
parent cd8319677d
commit a132ca9a54

View file

@ -419,7 +419,19 @@ should be applied to the background or to the foreground."
(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* ((backend (or backend
(car vc-buffer-overriding-fileset)
(vc-backend file)))
(file-buffer (get-file-buffer file))
(temp-buffer-name
(format "*Annotate %s (rev %s)*"
(if file-buffer
(buffer-name file-buffer)
;; Try to avoid ambiguity.
(file-relative-name file
(vc-call-backend backend 'root
default-directory)))
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
@ -436,10 +448,7 @@ should be applied to the background or to the foreground."
(rename-buffer temp-buffer-name t)
;; In case it had to be uniquified.
(setq temp-buffer-name (buffer-name))))
(let ((backend (or backend
(car vc-buffer-overriding-fileset)
(vc-backend file)))
(coding-system-for-read buffer-file-coding-system))
(let ((coding-system-for-read buffer-file-coding-system))
(with-output-to-temp-buffer temp-buffer-name
;; For a VC backend running on DOS/Windows, it's normal to
;; produce CRLF EOLs even if the original file has Unix EOLs,