]> code.delx.au - gnu-emacs-elpa/blobdiff - async.el
Prevent accidental creation of lexical closures.
[gnu-emacs-elpa] / async.el
index 4c79816d493bfdde4eda719bfd3c0d4f20e20988..8f893b9489bcd3c88d60d82ecf4b7631a3887538 100644 (file)
--- 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