diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el index 0a733336edd..a454a0bfc78 100644 --- a/lisp/vc/vc-dispatcher.el +++ b/lisp/vc/vc-dispatcher.el @@ -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, diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index b7200da0914..a18c463c848 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -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))