Subject: bug#52826: vc-revert fails on non-default buffer name

From: Juri Linkov <[email-masked]>
Date: Mon, 27 Dec 2021 19:53:38 +0200

When such customization is used:

  (add-hook 'diff-mode-hook 'rename-uniquely)

that uniquely renames *vc-diff* to *vc-diff*<number>,
then 'vc-revert' completely breaks up because of the hard-coded buffer name.
This patch should fix it:

diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 9fc9169821..5a99025289 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -2785,7 +2785,7 @@ vc-revert
     (unwind-protect
 	(when (if vc-revert-show-diff
 		  (progn
-		    (setq diff-buffer (generate-new-buffer-name "*vc-diff*"))
+		    (setq diff-buffer (generate-new-buffer "*vc-diff*"))
 		    (vc-diff-internal vc-allow-async-revert vc-fileset
 				      nil nil nil diff-buffer))
 		;; Avoid querying the user again.
--