From: pjb@informatimago.com (Pascal J. Bourguignon)
To: help-gnu-emacs@gnu.org
Subject: Re: Asynchronous Process Handling
Date: Fri, 26 Jun 2009 15:48:30 +0200 [thread overview]
Message-ID: <7cbpobkswh.fsf@pbourguignon.anevia.com> (raw)
In-Reply-To: c95b9606-f84b-4f14-ba03-3fa11025e1c6@g6g2000vbr.googlegroups.com
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__
prev parent reply other threads:[~2009-06-26 13:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-26 13:15 Asynchronous Process Handling Nordlöw
2009-06-26 13:48 ` Pascal J. Bourguignon [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7cbpobkswh.fsf@pbourguignon.anevia.com \
--to=pjb@informatimago.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).