]> code.delx.au - gnu-emacs-elpa/blob - README.md
Added note to README
[gnu-emacs-elpa] / README.md
1 # emacs-async
2
3 Adds the ability to process Lisp concurrently, with a very simple syntax:
4
5 (async-start
6 ;; What to do in the child process
7 (lambda ()
8 (message "This is a test")
9 (sleep-for 3)
10 222)
11
12 ;; What to do when it finishes
13 (lambda (result)
14 (message "Async process done, result should be 222: %s" result)))
15
16 If you omit the callback function, `async-start` will return a process object
17 that you can call `async-get` on when you're ready to wait for the result
18 value:
19
20 (let ((proc (async-start
21 ;; What to do in the child process
22 (lambda ()
23 (message "This is a test")
24 (sleep-for 3)
25 222))))
26 (message "I'm going to do some work here")
27 ;; ....
28 (message "Async process done, result should be 222: %s"
29 (async-get proc)))
30
31 If you don't want to use a callback, and you don't care about any return value
32 form the child proces, pass the `ignore` symbol as the second argument:
33
34 (async-start
35 (lambda ()
36 (delete-file "a remote file on a slow link" nil))
37 'ignore)