diff options
| author | Sean Whitton | 2025-04-05 10:58:35 +0800 |
|---|---|---|
| committer | Sean Whitton | 2025-05-09 10:52:06 +0100 |
| commit | 3739b86f5af654ec0ae3e47a3662e19ea79d2b3c (patch) | |
| tree | 1e7ae024715a865edd758c3f0a5343e65b3724d5 | |
| parent | 004187350238a05a5c7f818c9feb648c792fe9db (diff) | |
| download | emacs-3739b86f5af654ec0ae3e47a3662e19ea79d2b3c.tar.gz emacs-3739b86f5af654ec0ae3e47a3662e19ea79d2b3c.zip | |
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.
| -rw-r--r-- | lisp/vc/vc-dispatcher.el | 17 | ||||
| -rw-r--r-- | lisp/vc/vc-hg.el | 2 |
2 files changed, 11 insertions, 8 deletions
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." | |||
| 256 | 'help-echo | 256 | 'help-echo |
| 257 | "A command is in progress in this buffer")))) | 257 | "A command is in progress in this buffer")))) |
| 258 | 258 | ||
| 259 | (defun vc-exec-after (code &optional success) | 259 | (defun vc-exec-after (code &optional success proc) |
| 260 | "Eval CODE when the current buffer's process is done. | 260 | "Execute CODE when PROC, or the current buffer's process, is done. |
| 261 | If the current buffer has no process, just evaluate CODE. | ||
| 262 | Else, add CODE to the process' sentinel. | ||
| 263 | CODE should be a function of no arguments. | 261 | CODE should be a function of no arguments. |
| 264 | 262 | ||
| 265 | If SUCCESS, it should be a process object. Only run CODE if the | 263 | The optional PROC argument specifies the process Emacs should wait for |
| 266 | SUCCESS process has a zero exit code." | 264 | before executing CODE. It defaults to the current buffer's process. |
| 267 | (let ((proc (get-buffer-process (current-buffer)))) | 265 | If PROC is nil and the current buffer has no process, just evaluate |
| 266 | CODE. Otherwise, add CODE to the process's sentinel. | ||
| 267 | |||
| 268 | If SUCCESS, it should be a process object. | ||
| 269 | Only run CODE if the SUCCESS process has a zero exit code." | ||
| 270 | (let ((proc (or proc (get-buffer-process (current-buffer))))) | ||
| 268 | (cond | 271 | (cond |
| 269 | ;; If there's no background process, just execute the code. | 272 | ;; If there's no background process, just execute the code. |
| 270 | ;; We used to explicitly call delete-process on exited processes, | 273 | ;; 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." | |||
| 1381 | 1381 | ||
| 1382 | ;; Follows vc-hg-command (or vc-do-async-command), which uses vc-do-command | 1382 | ;; Follows vc-hg-command (or vc-do-async-command), which uses vc-do-command |
| 1383 | ;; from vc-dispatcher. | 1383 | ;; from vc-dispatcher. |
| 1384 | (declare-function vc-exec-after "vc-dispatcher" (code &optional success)) | 1384 | (declare-function vc-exec-after "vc-dispatcher" (code &optional success proc)) |
| 1385 | ;; Follows vc-exec-after. | 1385 | ;; Follows vc-exec-after. |
| 1386 | (declare-function vc-set-async-update "vc-dispatcher" (process-buffer)) | 1386 | (declare-function vc-set-async-update "vc-dispatcher" (process-buffer)) |
| 1387 | 1387 | ||