[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 386a876 019/187: Some minor adjustments
From: |
Michael Albinus |
Subject: |
[elpa] master 386a876 019/187: Some minor adjustments |
Date: |
Wed, 30 Dec 2015 11:49:26 +0000 |
branch: master
commit 386a876731e361dc676067c97977a0b3b2969e10
Author: John Wiegley <address@hidden>
Commit: John Wiegley <address@hidden>
Some minor adjustments
---
async.el | 73 ++++++++++++++++++++++++++++++++++---------------------------
1 files changed, 41 insertions(+), 32 deletions(-)
diff --git a/async.el b/async.el
index c0bc632..9ebebec 100644
--- a/async.el
+++ b/async.el
@@ -41,6 +41,7 @@
(defvar async-callback-for-process nil)
(defvar async-callback-value nil)
(defvar async-callback-value-set nil)
+(defvar async-current-process nil)
(defun async-inject-variables
(include-regexp &optional predicate exclude-regexp)
@@ -82,48 +83,56 @@ as follows:
"Process sentinal used to retrieve the value from the child process."
(when (eq 'exit (process-status proc))
(with-current-buffer (process-buffer proc)
- (if (= 0 (process-exit-status proc))
- (if async-callback-for-process
- (if async-callback
- (prog1
- (funcall async-callback proc)
- (unless async-debug
- (kill-buffer (current-buffer))))
- (set (make-local-variable 'async-callback-value) proc)
- (set (make-local-variable 'async-callback-value-set) t))
- (goto-char (point-max))
- (backward-sexp)
- (let ((result (read (current-buffer))))
- (if (and (listp result)
- (eq 'async-signal (car result)))
- (if (eq 'error (car (cdr result)))
- (error (cadr (cdr result)))
- (signal (cadr result)
- (cddr result)))
+ (let ((async-current-process proc))
+ (if (= 0 (process-exit-status proc))
+ (if async-callback-for-process
(if async-callback
(prog1
- (funcall async-callback result)
+ (funcall async-callback proc)
(unless async-debug
(kill-buffer (current-buffer))))
- (set (make-local-variable 'async-callback-value) result)
- (set (make-local-variable 'async-callback-value-set) t)))))
- (set (make-local-variable 'async-callback-value) 'error)
- (set (make-local-variable 'async-callback-value-set) t)
- (error "Async process '%s' failed with exit code %d"
- (process-name proc) (process-exit-status proc))))))
+ (set (make-local-variable 'async-callback-value) proc)
+ (set (make-local-variable 'async-callback-value-set) t))
+ (goto-char (point-max))
+ (backward-sexp)
+ (let ((result (read (current-buffer))))
+ (if (and (listp result)
+ (eq 'async-signal (car result)))
+ (if (eq 'error (car (cdr result)))
+ (error (cadr (cdr result)))
+ (signal (cadr result)
+ (cddr result)))
+ (if async-callback
+ (prog1
+ (funcall async-callback result)
+ (unless async-debug
+ (kill-buffer (current-buffer))))
+ (set (make-local-variable 'async-callback-value) result)
+ (set (make-local-variable 'async-callback-value-set) t)))))
+ (set (make-local-variable 'async-callback-value) 'error)
+ (set (make-local-variable 'async-callback-value-set) t)
+ (error "Async process '%s' failed with exit code %d"
+ (process-name proc) (process-exit-status proc)))))))
(defun async--receive-sexp (&optional stream)
- (let ((sexp (read (base64-decode-string (read stream)))))
+ (let ((sexp (if async-send-over-pipe
+ (read (base64-decode-string (read stream)))
+ (read stream))))
(if async-debug
(message "Received sexp {{{%s}}}" (pp-to-string sexp)))
(eval sexp)))
(defun async--insert-sexp (sexp)
- (prin1 sexp (current-buffer))
- ;; Just in case the string we're sending might contain EOF
- (base64-encode-region (point-min) (point-max) t)
- (goto-char (point-min)) (insert ?\")
- (goto-char (point-max)) (insert ?\" ?\n))
+ (if async-send-over-pipe
+ (progn
+ (prin1 sexp (current-buffer))
+ ;; Just in case the string we're sending might contain EOF
+ (base64-encode-region (point-min) (point-max) t)
+ (goto-char (point-min)) (insert ?\")
+ (goto-char (point-max)) (insert ?\" ?\n))
+ (let ((print-escape-newlines t))
+ (prin1 (list 'quote ,start-func) (current-buffer)))
+ (insert ?\n)))
(defun async--transmit-sexp (process sexp)
(with-temp-buffer
@@ -152,7 +161,7 @@ would result from a call to `async-get' on that FUTURE."
(defun async-wait (future)
"Wait for FUTURE to become ready."
(while (not (async-ready future))
- (sit-for 0 50)))
+ (sit-for 0.05)))
(defun async-get (future)
"Get the value from an asynchronously function when it is ready.
- [elpa] master 190a040 012/187: Fixed async-smtpmail-send-it, (continued)
- [elpa] master 190a040 012/187: Fixed async-smtpmail-send-it, Michael Albinus, 2015/12/30
- [elpa] master 4fb51ce 013/187: Corrected a problem with async deletions, Michael Albinus, 2015/12/30
- [elpa] master 1ad2902 011/187: Quiet byte-compiler warnings, Michael Albinus, 2015/12/30
- [elpa] master 742c82e 020/187: Added message passing, but undocumented for now, Michael Albinus, 2015/12/30
- [elpa] master b80f1a5 018/187: Don't use pipes for communication just yet, Michael Albinus, 2015/12/30
- [elpa] master 497e4da 024/187: Fix to dired-async for wdired-mode, Michael Albinus, 2015/12/30
- [elpa] master e08c251 017/187: Added `dired-async-use-native-commands', Michael Albinus, 2015/12/30
- [elpa] master 7ba4f40 022/187: Always base64 encode, Michael Albinus, 2015/12/30
- [elpa] master 1028235 023/187: Don't use lexical-binding in dired-async.el, Michael Albinus, 2015/12/30
- [elpa] master 12ca991 016/187: Made some macros into functions, added debug code, Michael Albinus, 2015/12/30
- [elpa] master 386a876 019/187: Some minor adjustments,
Michael Albinus <=
- [elpa] master dfaddaa 025/187: Use pipes instead of variable passing, Michael Albinus, 2015/12/30
- [elpa] master d771dff 015/187: Added `async-start-process', Michael Albinus, 2015/12/30
- [elpa] master 66610f4 026/187: smtpmail-async: Report status to user when done, Michael Albinus, 2015/12/30
- [elpa] master b7ec203 021/187: Fix for when async.el is byte-compiled, Michael Albinus, 2015/12/30
- [elpa] master 3f870f5 028/187: Show ops in progress `dired-async-in-process-face', Michael Albinus, 2015/12/30
- [elpa] master 1cec376 030/187: Added async-sandbox, Michael Albinus, 2015/12/30
- [elpa] master 24811ee 027/187: Show full backtraces if `async-debug' is non-nil, Michael Albinus, 2015/12/30
- [elpa] master 15f737f 032/187: Propagate non-zero exit codes as errors, Michael Albinus, 2015/12/30
- [elpa] master eda8d32 035/187: * helm-async.el (dired-create-file): Use quote., Michael Albinus, 2015/12/30
- [elpa] master ec1f0e8 034/187: * helm-async.el: let-bind dired-recursive-copies to 'always to avoid hanging on child., Michael Albinus, 2015/12/30