Re: elisp help

Glynn Clements <[email protected]> Thu, 26 Jan 2006 16:32:28 +0000
Newsgroups gmane.emacs.xemacs.general
Message-ID <[email protected]>
Bob Walters wrote:

> I am having trouble with getting background processes to work properly in a
> sequential order.  What I mean is, when I use background or comint-exec,
> whatever elisp functions are executed after the background process is
> invoked, but I want them to run when the background process terminates, not
> when it starts.
> 
> The only way I can think of to get this behavior would be to get the process
> id and poll it until it is done, but this won't work for me because I don't
> want to make the emacs process wait until the entire process is done.
> (otherwise I would have just used shell-command or something like that, but
> then again shell-command exibits the same issue, which I don't think is
> correct behavior)
> 
> Is it possible to have sequential control of forked/asynchronous processes
> in emacs, and if so, how would I do this.
> 
> Sorry if I overlooked something obvious, which I probably did.

It sounds like you need to use a process sentinel (a function which is
called if the process terminates, or is suspended or resumed). See the
"Sentinels" node in the "lispref" Info file for more information.

-- 
Glynn Clements <[email protected]>