branch: externals/async
commit 0190fb8e588cda776282c912e98be0f74ffa1ec9
Author: Thierry Volpiatto <thierry.volpia...@gmail.com>
Commit: Thierry Volpiatto <thierry.volpia...@gmail.com>

    Allow passing any value to async-let bindings.
    
    * async.el (async-let): Do it, also allow indenting properly.
---
 async.el | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/async.el b/async.el
index c074a4a..8bfd62d 100644
--- a/async.el
+++ b/async.el
@@ -319,12 +319,17 @@ For example:
      (async-start (bar)
       (lambda (y)
         (message \"%s %s\" x y)))))"
+  (declare (indent 1))
   (async--fold-left
    (lambda (acc binding)
-     `(async-start ,(cadr binding)
-                   (lambda (,(car binding))
-                     ,acc)))
-   forms (reverse bindings)))
+     (let ((fun (pcase (cadr binding)
+                  ((and (pred functionp) f) f)
+                  (f `(lambda () ,f)))))
+       `(async-start ,fun
+                     (lambda (,(car binding))
+                       ,acc))))
+   forms
+   (reverse bindings)))
 
 (provide 'async)
 

Reply via email to