[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master f6d7a74 074/187: Merge pull request #18 from DarwinAwardWi
From: |
Michael Albinus |
Subject: |
[elpa] master f6d7a74 074/187: Merge pull request #18 from DarwinAwardWinner/lexbind-fix |
Date: |
Wed, 30 Dec 2015 11:49:46 +0000 |
branch: master
commit f6d7a74b98bd6fd297de228fa980c8bcd72e430b
Merge: 242ae73 93b05a9
Author: John Wiegley <address@hidden>
Commit: John Wiegley <address@hidden>
Merge pull request #18 from DarwinAwardWinner/lexbind-fix
Lexbind fix
---
async-test.el | 21 +++++++++++++++++++++
async.el | 18 ++++++++++++++++--
2 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/async-test.el b/async-test.el
index 379cdf9..a5e83e9 100644
--- a/async-test.el
+++ b/async-test.el
@@ -29,6 +29,7 @@
;;; Code:
+(add-to-list 'load-path (file-name-directory (or load-file-name
(buffer-file-name))))
(require 'async)
(require 'async-file)
@@ -130,6 +131,26 @@
(lambda (result)
(message "Async process done: %s" result))))
+(defun async-test-7 ()
+ (interactive)
+ (message "Starting async-test-7...")
+ (eval
+ '(progn
+ (print
+ (mapcar #'async-get
+ (cl-loop repeat 2 collect
+ (async-start (lambda () t)))))
+ (print
+ (mapcar #'async-get
+ (cl-loop repeat 2 collect
+ (async-start '(lambda () t)))))
+ (print
+ (mapcar #'async-get
+ (cl-loop repeat 2 collect
+ (async-start `(lambda () ,(* 150 2)))))))
+ t)
+ (message "Finished async-test-7 successfully."))
+
(defsubst async-file-contents (file)
"Return the contents of FILE, as a string."
(with-temp-buffer
diff --git a/async.el b/async.el
index 4c79816..c4485d6 100644
--- a/async.el
+++ b/async.el
@@ -260,8 +260,22 @@ 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'."
(require 'find-func)
- (let ((procvar (make-symbol "proc")))
- `(let* ((sexp ,start-func)
+ (let* ((procvar (make-symbol "proc"))
+ ;; Evaluate START-FUNC if it isn't aready a function.
+ (start-func
+ (if (functionp start-func)
+ start-func
+ (eval start-func)))
+ (start-func
+ (if (eq (car start-func) 'lambda)
+ (eval start-func t)
+ start-func)))
+ ;; If START-FUNC is a lambda, prevent it from creating a lexical
+ ;; closure by evaluating it in an empty lexical environment.
+ (when (eq (car start-func) 'lambda)
+ (setq start-func
+ (eval start-func t)))
+ `(let* ((sexp #',start-func)
(,procvar
(async-start-process
"emacs" (file-truename
- [elpa] master c029934 066/187: * helm-async.el: Add comments about incompatibility with dired-async.el and async-file.el., (continued)
- [elpa] master c029934 066/187: * helm-async.el: Add comments about incompatibility with dired-async.el and async-file.el., Michael Albinus, 2015/12/30
- [elpa] master fb8f10b 065/187: * helm-async.el (dired-create-files): Handle `dired-recursive-copies' when async too., Michael Albinus, 2015/12/30
- [elpa] master bcffaeb 067/187: * helm-async.el (dired-create-file): Revert changes in fb8f10b., Michael Albinus, 2015/12/30
- [elpa] master 8e05e02 070/187: Prevent accidental creation of lexical closures., Michael Albinus, 2015/12/30
- [elpa] master 9c02acd 069/187: Add test for #17., Michael Albinus, 2015/12/30
- [elpa] master 5ef546a 071/187: Have test file add its own directory to load path, Michael Albinus, 2015/12/30
- [elpa] master 242ae73 068/187: * helm-async.el: Fix error handling., Michael Albinus, 2015/12/30
- [elpa] master 93b05a9 073/187: More robust evaluation and closure-protection of start-func, Michael Albinus, 2015/12/30
- [elpa] master ba705c6 076/187: Add test for handling different ways of passing a function, Michael Albinus, 2015/12/30
- [elpa] master b6d990d 075/187: Add lexbind test, Michael Albinus, 2015/12/30
- [elpa] master f6d7a74 074/187: Merge pull request #18 from DarwinAwardWinner/lexbind-fix,
Michael Albinus <=
- [elpa] master 9b5bb5c 072/187: Add more comprehensive testing for anti-closure feature, Michael Albinus, 2015/12/30
- [elpa] master 204750d 081/187: Revert "* helm-async.el: Fix error handling.", Michael Albinus, 2015/12/30
- [elpa] master b05c63a 083/187: Don't rely on async.el being in load-path., Michael Albinus, 2015/12/30
- [elpa] master 374f514 079/187: Complete the docstring for "async--get-function", Michael Albinus, 2015/12/30
- [elpa] master 9704eb8 080/187: Merge pull request #21 from DarwinAwardWinner/lexbind-fix, Michael Albinus, 2015/12/30
- [elpa] master 4a7b07b 084/187: Merge pull request #23 from DarwinAwardWinner/no-load-path-fix, Michael Albinus, 2015/12/30
- [elpa] master 2a532d3 077/187: Replace closure prevention with closure sanitation, Michael Albinus, 2015/12/30
- [elpa] master f18c735 078/187: Merge pull request #19 from DarwinAwardWinner/lexbind-fix, Michael Albinus, 2015/12/30
- [elpa] master 3f751fb 082/187: Revert master back to 242ae73, Michael Albinus, 2015/12/30
- [elpa] master eff5419 088/187: Rename helm-async.el to dired-async.el, Michael Albinus, 2015/12/30