]> git.eshelyaron.com Git - emacs.git/commitdiff
vc-exec-after: New PROC argument
authorSean Whitton <spwhitton@spwhitton.name>
Sat, 5 Apr 2025 02:58:35 +0000 (10:58 +0800)
committerEshel Yaron <me@eshelyaron.com>
Sat, 10 May 2025 08:55:52 +0000 (10:55 +0200)
* lisp/vc/vc-dispatcher.el (vc-exec-after): New PROC argument.
* lisp/vc/vc-hg.el (vc-exec-after): Update declaration.

(cherry picked from commit 3739b86f5af654ec0ae3e47a3662e19ea79d2b3c)

lisp/vc/vc-dispatcher.el
lisp/vc/vc-hg.el

index 2db9ea9cbaa4f2c95c818cd17a67af181fc01f28..dc71c6c4a9af5228dfe36b2fa6575d9e8ce7e5c3 100644 (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,
index b7200da09140ae6bfa15e8756fbce8736cce80d5..a18c463c84805a06fbd38d8760aa71c339bf88e3 100644 (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))