emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 93b05a9 073/187: More robust evaluation and closure-protec


From: Michael Albinus
Subject: [elpa] master 93b05a9 073/187: More robust evaluation and closure-protection of start-func
Date: Wed, 30 Dec 2015 11:49:46 +0000

branch: master
commit 93b05a955584cd8f3f7b75c5888c41db7bc7c878
Author: Ryan C. Thompson <address@hidden>
Commit: Ryan C. Thompson <address@hidden>

    More robust evaluation and closure-protection of start-func
---
 async.el |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/async.el b/async.el
index 8f893b9..c4485d6 100644
--- a/async.el
+++ b/async.el
@@ -260,10 +260,21 @@ 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"))
-        ;; Avoid accidental lexical closures by evaluating START-FUNC
-        ;; in an empty lexical environment.
-        (start-func (eval start-func t)))
+  (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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]