From c6e550c24eb25a72cdef2d691649a3754feb75d8 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Fri, 6 Feb 2026 14:06:36 +0000 Subject: [PATCH] Separate input histories for 'C-x v !' and Git pulling & pushing * lisp/vc/vc-dispatcher.el (vc-user-edit-command-history): Use this as a dynamically bound variable, not a minibuffer history. (vc-user-edit-command): Pass its value to read-shell-command. * lisp/vc/vc-git.el (vc-git--pushpull): * lisp/vc/vc.el (vc-edit-next-command): Bind it. (vc-edit-next-command-history): New variable. * etc/NEWS: Document the change. --- etc/NEWS | 6 ++++-- lisp/vc/vc-dispatcher.el | 4 ++-- lisp/vc/vc-git.el | 4 +++- lisp/vc/vc.el | 6 +++++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 3795913d99c..6e8763a678d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2887,8 +2887,10 @@ To enable it again, use 'M-x enable-command'. --- *** 'C-x v !' has its own input history. -This is shared with the input history of 'C-x v P' for certain backends -which use the same mechanism as 'C-x v !'. + +--- +*** 'C-u C-x v +' and 'C-u C-x v P' for Git have an input history. +This was already in place for Mercurial. ** Package diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el index 374ae778d55..2015e7540ae 100644 --- a/lisp/vc/vc-dispatcher.el +++ b/lisp/vc/vc-dispatcher.el @@ -385,7 +385,7 @@ the man pages for \"torsocks\" for more details about Tor." :group 'vc) (defvar vc-user-edit-command-history nil - "Minibuffer history for `vc-user-edit-command'.") + "Name of minibuffer history variable for `vc-user-edit-command'.") (defun vc-user-edit-command (command file-or-list flags) "Prompt the user to edit VC command COMMAND and FLAGS. @@ -402,7 +402,7 @@ Intended to be used as the value of `vc-filter-command-function'." (butlast flags) flags)))) " ") - 'vc-user-edit-command-history)))) + vc-user-edit-command-history)))) (list (car edited) file-or-list (nconc (cdr edited) (and files-separator-p '("--")))))) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 9c97fcad97d..85e90bfc25a 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1614,7 +1614,9 @@ If PROMPT is non-nil, prompt for the Git command to run." (vc-filter-command-function (if prompt (lambda (&rest args) - (cl-destructuring-bind (&whole args git _ flags) + (cl-destructuring-bind + (&whole args git _ flags + &aux (vc-user-edit-command-history 'vc-git-history)) (apply #'vc-user-edit-command args) (setq git-program git command (car flags) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 3d85453a3b3..88324a2a444 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -5026,6 +5026,9 @@ log entries should be gathered." (defvar vc-filter-command-function) +(defvar vc-edit-next-command-history nil + "Minibuffer history for `vc-edit-next-command'.") + ;;;###autoload (defun vc-edit-next-command () "Request editing the next VC shell command before execution. @@ -5049,7 +5052,8 @@ immediately after this one." (add-hook 'prefix-command-echo-keystrokes-functions echofun) (setq vc-filter-command-function (lambda (&rest args) - (apply #'vc-user-edit-command (apply old args)))))) + (let ((vc-user-edit-command-history 'vc-edit-next-command-history)) + (apply #'vc-user-edit-command (apply old args))))))) ;; This is used in .dir-locals.el in the Emacs source tree. ;;;###autoload (put 'vc-prepare-patches-separately 'safe-local-variable 'booleanp)