emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 1cec376 030/187: Added async-sandbox


From: Michael Albinus
Subject: [elpa] master 1cec376 030/187: Added async-sandbox
Date: Wed, 30 Dec 2015 11:49:30 +0000

branch: master
commit 1cec376f579afc1dca784f95a5f98212acd590b5
Author: John Wiegley <address@hidden>
Commit: John Wiegley <address@hidden>

    Added async-sandbox
---
 async.el |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/async.el b/async.el
index e951b69..f20c9af 100644
--- a/async.el
+++ b/async.el
@@ -156,8 +156,9 @@ as follows:
 (defun async-ready (future)
   "Query a FUTURE to see if the ready is ready -- i.e., if no blocking
 would result from a call to `async-get' on that FUTURE."
-  (and (eq 'exit (process-status future))
-       async-callback-value-set))
+  (with-current-buffer (process-buffer future)
+    (and (memq (process-status future) '(exit signal))
+         async-callback-value-set)))
 
 (defun async-wait (future)
   "Wait for FUTURE to become ready."
@@ -168,8 +169,8 @@ would result from a call to `async-get' on that FUTURE."
   "Get the value from an asynchronously function 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-wait future)
     (prog1
         async-callback-value
       (kill-buffer (current-buffer)))))
@@ -274,6 +275,10 @@ returns nil.  It can still be useful, however, as an 
argument to
              `((async--transmit-sexp ,procvar (list 'quote sexp))))
        ,procvar)))
 
+(defmacro async-sandbox(func)
+  "Evaluate FUNC in a separate Emacs process, synchronously."
+  `(async-get (async-start ,func)))
+
 (defun async-test-1 ()
   (interactive)
   (message "Starting async-test-1...")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]