Subject: bug#50344: C-x v keybinding for vc-print-branch-log

From: Juri Linkov <[email-masked]>
Date: Thu, 07 Oct 2021 10:21:45 +0300

> I realized that quite likely many users already rely on 'C-x v s'
> and 'C-x v r' to create/switch branches because currently there is
> no other quick way to do these frequent actions.  OTOH, I don't
> believe that 'vc-switch-backend' is used often.  So it seems pretty safe
> to just create a new prefix key map for 'C-x v b', and rebind 'vc-switch-backend'
> to 'C-x v B'.  Then leave 'C-x v r' and 'C-x v s' unchanged to give
> users time to adopt to the new branch-related prefix map 'C-x v b'.

It will take more time to create branch commands due to many problems.
So the best what we could do now is to rebind 'vc-switch-backend'
from 'C-x v b' to 'C-x v B' in emacs-28 to give time to adapt
to  new keybinding.  'vc-switch-backend' was announced in NEWS thusly:

  If a file is registered in multiple backends, you can switch to
  another one using C-x v b (vc-switch-backend).  This does not change
  any files, it only changes VC's perspective on the file.  Use this to
  pick up changes from CVS while working under RCS locally.

So it was intended to switch backends between CVS and RCS.

diff --git a/etc/NEWS b/etc/NEWS
index 8b327fac0f..26af52af58 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3299,6 +3299,10 @@ Setting this to nil inhibits that.
 ** 'vc-print-branch-log' shows the change log from its root directory.
 It previously used to use the default directory.
 
+---
+** 'vc-switch-backend' is rebound from 'C-x v b' to 'C-x v B'.
+The prefix key 'C-x v b' is reserved for coming branch commands.
+
 ---
 ** 'project-shell' and 'shell' now use 'pop-to-buffer-same-window'.
 This is to keep the same behavior as Eshell.
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index b7760e3bba..7455a306bc 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -864,7 +864,8 @@ vc-kill-buffer-hook
 (defvar vc-prefix-map
   (let ((map (make-sparse-keymap)))
     (define-key map "a" #'vc-update-change-log)
-    (define-key map "b" #'vc-switch-backend)
+    ;; TODO: Use the prefix key "b" for branch commands.
+    (define-key map "B" #'vc-switch-backend)
     (define-key map "d" #'vc-dir)
     (define-key map "g" #'vc-annotate)
     (define-key map "G" #'vc-ignore)