branch: master
commit 8e05e0208cb91d44c4e10ac6f9532d3cfcd04fe9
Author: Ryan C. Thompson <[email protected]>
Commit: Ryan C. Thompson <[email protected]>
Prevent accidental creation of lexical closures.
Fixes #17. (Try async-test-7)
---
async.el | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/async.el b/async.el
index 4c79816..8f893b9 100644
--- a/async.el
+++ b/async.el
@@ -260,8 +260,11 @@ 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"))
+ ;; Avoid accidental lexical closures by evaluating START-FUNC
+ ;; in an empty lexical environment.
+ (start-func (eval start-func t)))
+ `(let* ((sexp #',start-func)
(,procvar
(async-start-process
"emacs" (file-truename