[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Asynchronous Process Handling
From: |
Pascal J. Bourguignon |
Subject: |
Re: Asynchronous Process Handling |
Date: |
Fri, 26 Jun 2009 15:48:30 +0200 |
User-agent: |
Gnus/5.101 (Gnus v5.10.10) Emacs/22.2 (gnu/linux) |
Nordlöw <per.nordlow@gmail.com> writes:
> Is it possible to call a process asynchronously from with emacs and
> later get back an async message or notification when the process has
> finished possibly along with its return value and or output?
Yes. You can do it with processes and process filters. I let you
read the documentation about them.
Here is another solution, which has the advantage for long processes,
to work even if you relaunch emacs.
Put:
(defun process-my-result (result)
(switch-to-buffer "*result*")
(insert (format "%S" result)))
(server-start)
in ~/.emacs
and launch the process as:
(shell-command "( sleep 10 ; result=42 ; emacsclient --eval
\"(process-my-result $result)\" ) & disown &"
nil nil)
--
__Pascal Bourguignon__