[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/async e22e612 11/60: Fix and clarify async-ready, async
From: |
Stefan Monnier |
Subject: |
[elpa] externals/async e22e612 11/60: Fix and clarify async-ready, async-get and async-wait (#71). |
Date: |
Tue, 8 Oct 2019 10:11:28 -0400 (EDT) |
branch: externals/async
commit e22e6125f3a9280af79dfc675f3d6fdba3e7fec9
Author: Thierry Volpiatto <address@hidden>
Commit: Thierry Volpiatto <address@hidden>
Fix and clarify async-ready, async-get and async-wait (#71).
* async.el (async-ready): Ensure proc buffer is alive
and return t if buffer is not alive. Fix docstring.
(async--wait): Renamed from async-wait.
(async-get): Ensure proc buffer is alive. Fix docstring.
(async-start): Docstring only.
---
async.el | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/async.el b/async.el
index 0bb45fa..610dd75 100644
--- a/async.el
+++ b/async.el
@@ -169,24 +169,32 @@ as follows:
(prin1 (list 'async-signal err)))))))
(defun async-ready (future)
- "Query a FUTURE to see if the ready is ready -- i.e., if no blocking
+ "Query a FUTURE to see if it is ready.
+
+I.e., if no blocking
would result from a call to `async-get' on that FUTURE."
(and (memq (process-status future) '(exit signal))
- (with-current-buffer (process-buffer future)
- async-callback-value-set)))
+ (let ((buf (process-buffer future)))
+ (if (buffer-live-p buf)
+ (with-current-buffer buf
+ async-callback-value-set)
+ t))))
-(defun async-wait (future)
+(defun async--wait (future)
"Wait for FUTURE to become ready."
(while (not (async-ready future))
(sit-for 0.05)))
(defun async-get (future)
- "Get the value from an asynchronously function when it is ready.
+ "Get the value from process FUTURE when it is ready.
FUTURE is returned by `async-start' or `async-start-process' when
its FINISH-FUNC is nil."
- (async-wait future)
- (with-current-buffer (process-buffer future)
- (async-handle-result #'identity async-callback-value (current-buffer))))
+ (and future (async--wait future))
+ (let ((buf (process-buffer future)))
+ (when (buffer-live-p buf)
+ (with-current-buffer buf
+ (async-handle-result
+ #'identity async-callback-value (current-buffer))))))
(defun async-message-p (value)
"Return true of VALUE is an async.el message packet."
@@ -270,7 +278,7 @@ Note: Even when FINISH-FUNC is present, a future is still
returned except that it yields no value (since the value is
passed to FINISH-FUNC). Call `async-get' on such a future always
returns nil. It can still be useful, however, as an argument to
-`async-ready' or `async-wait'."
+`async-ready'."
(let ((sexp start-func)
;; Subordinate Emacs will send text encoded in UTF-8.
(coding-system-for-read 'utf-8-unix))
- [elpa] externals/async 6c9c3a2 17/60: Update README.md, (continued)
- [elpa] externals/async 6c9c3a2 17/60: Update README.md, Stefan Monnier, 2019/10/08
- [elpa] externals/async e5e636c 19/60: Update version number., Stefan Monnier, 2019/10/08
- [elpa] externals/async ea83ef5 23/60: Use emacs -q flag to fix issue #80 with emacs-26, Stefan Monnier, 2019/10/08
- [elpa] externals/async 87853ae 29/60: Allow backing up in same directory, Stefan Monnier, 2019/10/08
- [elpa] externals/async 424ecd8 32/60: Fix compilation warning, Stefan Monnier, 2019/10/08
- [elpa] externals/async 15bcbf6 37/60: Use user-emacs-directory (#95), Stefan Monnier, 2019/10/08
- [elpa] externals/async 0b545da 53/60: Only revert dired buffers if not remote, Stefan Monnier, 2019/10/08
- [elpa] externals/async d0a29f1 46/60: Copy source files when installing, Stefan Monnier, 2019/10/08
- [elpa] externals/async ec374ca 57/60: Use consp instead of listp, Stefan Monnier, 2019/10/08
- [elpa] externals/async e5f8a7f 56/60: Merge branch 'master' of github.com:jwiegley/emacs-async, Stefan Monnier, 2019/10/08
- [elpa] externals/async e22e612 11/60: Fix and clarify async-ready, async-get and async-wait (#71).,
Stefan Monnier <=
- [elpa] externals/async d395e92 25/60: Use only -q flag when needed, Stefan Monnier, 2019/10/08
- [elpa] externals/async 09a177c 21/60: Update README., Stefan Monnier, 2019/10/08
- [elpa] externals/async 953a614 26/60: Add mode line lighter for dired-async-mode, Stefan Monnier, 2019/10/08
- [elpa] externals/async 868d927 33/60: Add .gitignore, Stefan Monnier, 2019/10/08
- [elpa] externals/async 7fa23eb 44/60: Update dired-buffers when operation ends (#99), Stefan Monnier, 2019/10/08
- [elpa] externals/async efe6bda 45/60: Check if dired buffer is alive before reverting (#99), Stefan Monnier, 2019/10/08
- [elpa] externals/async c9bd058 48/60: DRY in async-inject-variables, Stefan Monnier, 2019/10/08
- [elpa] externals/async 5863eef 28/60: Copy the autoload file when installing, Stefan Monnier, 2019/10/08
- [elpa] externals/async dea9627 31/60: Merge pull request #87 from darkfeline/async, Stefan Monnier, 2019/10/08
- [elpa] externals/async 8bb64e3 41/60: Require cl-lib., Stefan Monnier, 2019/10/08