vc-exec-after: New PROC argument

* lisp/vc/vc-dispatcher.el (vc-exec-after): New PROC argument.
* lisp/vc/vc-hg.el (vc-exec-after): Update declaration.
This commit is contained in:
Sean Whitton 2025-04-05 10:58:35 +08:00
parent 0041873502
commit 3739b86f5a
2 changed files with 11 additions and 8 deletions

View file

@ -256,15 +256,18 @@ Another is that undo information is not kept."
'help-echo
"A command is in progress in this buffer"))))
(defun vc-exec-after (code &optional success)
"Eval CODE when the current buffer's process is done.
If the current buffer has no process, just evaluate CODE.
Else, add CODE to the process' sentinel.
(defun vc-exec-after (code &optional success proc)
"Execute CODE when PROC, or the current buffer's process, is done.
CODE should be a function of no arguments.
If SUCCESS, it should be a process object. Only run CODE if the
SUCCESS process has a zero exit code."
(let ((proc (get-buffer-process (current-buffer))))
The optional PROC argument specifies the process Emacs should wait for
before executing CODE. It defaults to the current buffer's process.
If PROC is nil and the current buffer has no process, just evaluate
CODE. Otherwise, add CODE to the process's sentinel.
If SUCCESS, it should be a process object.
Only run CODE if the SUCCESS process has a zero exit code."
(let ((proc (or proc (get-buffer-process (current-buffer)))))
(cond
;; If there's no background process, just execute the code.
;; We used to explicitly call delete-process on exited processes,

View file

@ -1381,7 +1381,7 @@ REV is the revision to check out into WORKFILE."
;; Follows vc-hg-command (or vc-do-async-command), which uses vc-do-command
;; from vc-dispatcher.
(declare-function vc-exec-after "vc-dispatcher" (code &optional success))
(declare-function vc-exec-after "vc-dispatcher" (code &optional success proc))
;; Follows vc-exec-after.
(declare-function vc-set-async-update "vc-dispatcher" (process-buffer))