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.
This commit is contained in:
Sean Whitton 2026-02-06 14:06:36 +00:00
parent 90d3fdaffc
commit c6e550c24e
4 changed files with 14 additions and 6 deletions

View file

@ -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

View file

@ -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 '("--"))))))

View file

@ -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)

View file

@ -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)