Browse files

Prevent accidental creation of lexical closures.

Fixes #17. (Try async-test-7)
  • Loading branch information...
1 parent 9c02acd commit 8e05e0208cb91d44c4e10ac6f9532d3cfcd04fe9 @DarwinAwardWinner committed Oct 17, 2013
Showing with 5 additions and 2 deletions.
  1. +5 −2 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)
"emacs" (file-truename

5 comments on commit 8e05e02


What about using apply-partially instead of eval?


That appears to work too.


Actually, it seems to fail some tests when I use apply-partially.


Ok, I got apply-partially to work correctly. However, I don't really see the advantage over eval.

Please sign in to comment.