From ed87a95a786cca2cb5ddd116563a0ded2fafd1a9 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Wed, 3 Dec 2025 16:09:52 +0000 Subject: [PATCH] Query-on-exit for VC push, pull and async checkin commands * lisp/vc/vc-bzr.el (vc-bzr--pushpull): * lisp/vc/vc-git.el (vc-git--checkin, vc-git--pushpull): * lisp/vc/vc-hg.el (vc-hg--checkin, vc-hg--pushpull): Set query-on-exit flag for async processes. --- lisp/vc/vc-bzr.el | 1 + lisp/vc/vc-git.el | 23 +++++++++++++---------- lisp/vc/vc-hg.el | 11 ++++++++--- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el index fb7361120fb..1a4afc6ec90 100644 --- a/lisp/vc/vc-bzr.el +++ b/lisp/vc/vc-bzr.el @@ -385,6 +385,7 @@ If PROMPT is non-nil, prompt for the Bzr command to run." args (cddr args))) (require 'vc-dispatcher) (let ((buf (apply #'vc-bzr-async-command command args))) + (set-process-query-on-exit-flag (get-buffer-process buf) t) (with-current-buffer buf (vc-run-delayed (vc-compilation-mode 'bzr) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index eede3955d7e..7ac4255f132 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1320,16 +1320,18 @@ It is an error to supply both or neither." (and (not patch-string) (if only (list "--only" "--") '("-a"))))) (if vc-async-checkin - (progn (vc-wait-for-process-before-save - (apply #'vc-do-async-command buffer root - vc-git-program (nconc args files)) - "Finishing checking in files...") - (with-current-buffer buffer - (vc-run-delayed - (vc-compilation-mode 'git) - (funcall post))) - (vc-set-async-update buffer) - (list 'async (get-buffer-process buffer))) + (let ((proc (apply #'vc-do-async-command buffer root + vc-git-program (nconc args files)))) + (set-process-query-on-exit-flag proc t) + (vc-wait-for-process-before-save + proc + "Finishing checking in files...") + (with-current-buffer buffer + (vc-run-delayed + (vc-compilation-mode 'git) + (funcall post))) + (vc-set-async-update buffer) + (list 'async (get-buffer-process buffer))) (apply #'vc-git-command nil 0 files args) (funcall post))))) @@ -1527,6 +1529,7 @@ If PROMPT is non-nil, prompt for the Git command to run." vc-filter-command-function)) (proc (apply #'vc-do-async-command buffer root git-program command extra-args))) + (set-process-query-on-exit-flag proc t) ;; "git pull" includes progress output that uses ^M to move point ;; to the beginning of the line. Just translate these to newlines ;; (but don't do anything with the CRLF sequence). diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index 7bbd5d778b6..6f38747e8b0 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -1291,9 +1291,12 @@ It is an error to supply both or neither." (vc-hg-command nil 0 nil "update" "--merge" "--tool" "internal:local" "tip"))))) (if vc-async-checkin - (let ((buffer (vc-hg--async-buffer))) + (let* ((buffer (vc-hg--async-buffer)) + (proc (apply #'vc-hg--async-command buffer + (nconc args files)))) + (set-process-query-on-exit-flag proc t) (vc-wait-for-process-before-save - (apply #'vc-hg--async-command buffer (nconc args files)) + proc (if patch-file "Finishing checking in patch...." "Finishing checking in files...")) @@ -1613,7 +1616,9 @@ revisions, fetch only those revisions." (setq hg-program (car args) command (cadr args) args (cddr args))) - (apply #'vc-do-async-command buffer root hg-program command args) + (set-process-query-on-exit-flag + (apply #'vc-do-async-command buffer root hg-program command args) + t) (with-current-buffer buffer (vc-run-delayed (dolist (cmd post-processing)