[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: async 1.0
From: |
John Wiegley |
Subject: |
Re: async 1.0 |
Date: |
Fri, 22 Jun 2012 16:39:23 -0500 |
User-agent: |
Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.1 (darwin) |
>>>>> Richard Stallman <address@hidden> writes:
> I didn't realize it could be so fast. On my machine, emacs -Q -batch --eval
> "(+ 10 20)" takes about 1/4 second.
What kind of hardware are you using? The Emacs that I'm running in off an SSD
with a lot of cache RAM available. If I do it on my laptop, which also has an
SSD, I get the same times: 0.03713s.
I've also found another use for async.el: sandboxing. The following allows me
execute a lambda synchronously, but without affecting the host Emacs
environment:
(async-get (async-start FUNC))
I see this idiom being useful enough that I've reduced it to one function,
(async-sandbox FUNC).
Here's an example of using sandboxing to byte-compile a file, without letting
`eval-when-compile' forms affect the host environment:
(let ((proc
(async-start
`(lambda ()
(require 'bytecomp)
,(async-inject-variables "\\`load-path\\'")
(let ((default-directory ,(file-name-directory file)))
(add-to-list 'load-path default-directory)
(ignore-errors
(load ,file))
;; returns nil if there were any errors
(prog1
(byte-compile-file ,file)
(load ,file)))))))
(unless (condition-case err
(async-get proc)
(error
(ignore (message "Error: %s" err))))
(ignore (message "Recompiling %s...FAILED" file))))
John
- Re: async 1.0, (continued)
- Re: async 1.0, John Wiegley, 2012/06/25
- ELPA and core services, John Wiegley, 2012/06/24
- Re: ELPA and core services, Lennart Borgman, 2012/06/24
- Re: ELPA and core services, Stefan Monnier, 2012/06/24
- ELPA and core services, Stephen J. Turnbull, 2012/06/25
- Re: ELPA and core services, Achim Gratz, 2012/06/25
- stdlib for Emacs? [was: async 1.0], Stephen J. Turnbull, 2012/06/25
- Re: async 1.0, Stephen J. Turnbull, 2012/06/23
- Re: async 1.0, John Wiegley, 2012/06/23
Re: async 1.0, Richard Stallman, 2012/06/22
- Re: async 1.0,
John Wiegley <=