[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 0a7f3dd 008/187: Added async-inject-environment
From: |
Michael Albinus |
Subject: |
[elpa] master 0a7f3dd 008/187: Added async-inject-environment |
Date: |
Wed, 30 Dec 2015 11:49:22 +0000 |
branch: master
commit 0a7f3dd82b6959405826dff5973d0a757ca4c39b
Author: John Wiegley <address@hidden>
Commit: John Wiegley <address@hidden>
Added async-inject-environment
---
async.el | 28 +++++++++++++++++++++++++++-
1 files changed, 27 insertions(+), 1 deletions(-)
diff --git a/async.el b/async.el
index 6b9dab2..01865c0 100644
--- a/async.el
+++ b/async.el
@@ -72,6 +72,31 @@
(defvar async-callback-value nil)
(defvar async-callback-value-set nil)
+(defmacro async-inject-environment
+ (include-regexp &optional predicate exclude-regexp)
+ "Inject a part of the parent environment into an async function."
+ `(setq
+ ,@(let (bindings)
+ (mapatoms
+ (lambda (sym)
+ (if (and (boundp sym)
+ (or (null include-regexp)
+ (string-match include-regexp (symbol-name sym)))
+ (not (string-match
+ (or exclude-regexp "-syntax-table\\'")
+ (symbol-name sym))))
+ (let ((value (symbol-value sym)))
+ (when (or (null predicate)
+ (funcall (or predicate
+ (lambda (sym)
+ (let ((value (symbol-value sym)))
+ (or (not (functionp value))
+ (symbolp value))))) sym))
+ (setq bindings (cons `(quote ,value)
+ bindings))
+ (setq bindings (cons sym bindings)))))))
+ bindings)))
+
(defun async-when-done (proc &optional change)
"Process sentinal used to retrieve the value from the child process."
(when (eq 'exit (process-status proc))
@@ -85,7 +110,8 @@
(eq 'async-signal (car result)))
(if (eq 'error (car (cdr result)))
(error (cadr (cdr result)))
- (apply #'signal (cdr result)))
+ (signal (cadr result)
+ (cddr result)))
(if async-callback
(prog1
(funcall async-callback result)
- [elpa] master updated (e053cef -> ef4a542), Michael Albinus, 2015/12/30
- [elpa] master 6647749 002/187: Small change, Michael Albinus, 2015/12/30
- [elpa] master 8d37c00 004/187: Added note to README, Michael Albinus, 2015/12/30
- [elpa] master 4733d1e 001/187: Initial revision, Michael Albinus, 2015/12/30
- [elpa] master 3d388c6 007/187: Added support for signal propagation, Michael Albinus, 2015/12/30
- [elpa] master 0a7f3dd 008/187: Added async-inject-environment,
Michael Albinus <=
- [elpa] master 954c865 006/187: Updated README, Michael Albinus, 2015/12/30
- [elpa] master a8ac820 003/187: Renamed emacs-async.el to async.el, Michael Albinus, 2015/12/30
- [elpa] master 63fe7ee 010/187: Updated README, Michael Albinus, 2015/12/30
- [elpa] master c48d3db 009/187: Added smtpmail-async.el, Michael Albinus, 2015/12/30
- [elpa] master 728e791 005/187: Added dired-async, Michael Albinus, 2015/12/30
- [elpa] master 628a295 014/187: Send data over a pipe, rather than in an argument, Michael Albinus, 2015/12/30
- [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