[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: async.el: A simple asynchronous framework for Emacs
From: |
John Wiegley |
Subject: |
Re: async.el: A simple asynchronous framework for Emacs |
Date: |
Tue, 19 Jun 2012 19:53:47 -0500 |
User-agent: |
Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.1 (darwin) |
Apropos of nothing, just discovered that `apply-partially' is a nice way to
run one-liners asynchronously:
(async-start (apply-partially #'copy-file from to ok-flag preserve-time)
(apply-partially #'message "Copy done: %s -> %s" from to))
The alternative is less consistent:
(async-start `(lambda () (copy-file ,from ,to ,ok-flag ,preserve-time))
(lambda () (message "Copy done: %s -> %s" from to)))
Since `form' and `to' need their values passed to the child process, while the
variables remain in scope for the callback (thanks to closures). Of course,
the <24 version is equally consistent in its ugliness:
(async-start `(lambda () (copy-file ,from ,to ,ok-flag ,preserve-time))
`(lambda () (message "Copy done: %s -> %s" ,from ,to)))
John
- async.el: A simple asynchronous framework for Emacs, John Wiegley, 2012/06/18
- Re: async.el: A simple asynchronous framework for Emacs, Thien-Thi Nguyen, 2012/06/19
- Re: async.el: A simple asynchronous framework for Emacs, Stefan Monnier, 2012/06/19
- Re: async.el: A simple asynchronous framework for Emacs, John Wiegley, 2012/06/19
- Re: async.el: A simple asynchronous framework for Emacs, John Wiegley, 2012/06/20
- Re: async.el: A simple asynchronous framework for Emacs, SAKURAI Masashi, 2012/06/20
- Re: async.el: A simple asynchronous framework for Emacs, John Wiegley, 2012/06/20
- Re: async.el: A simple asynchronous framework for Emacs, John Wiegley, 2012/06/20
- Re: async.el: A simple asynchronous framework for Emacs, John Wiegley, 2012/06/20
- Re: async.el: A simple asynchronous framework for Emacs, SAKURAI Masashi, 2012/06/20
- Re: async.el: A simple asynchronous framework for Emacs, Thien-Thi Nguyen, 2012/06/20
- Re: async.el: A simple asynchronous framework for Emacs, John Wiegley, 2012/06/20
- Re: async.el: A simple asynchronous framework for Emacs, Thien-Thi Nguyen, 2012/06/21
- Re: async.el: A simple asynchronous framework for Emacs, Le Wang, 2012/06/22