Commit bf351cc2 authored by Karl Heuer's avatar Karl Heuer

(status_notify): If Vprocess_alist changes within

the loop, do the whole loop again.
parent c344d4be
...@@ -3386,6 +3386,7 @@ status_notify () ...@@ -3386,6 +3386,7 @@ status_notify ()
register Lisp_Object proc, buffer; register Lisp_Object proc, buffer;
Lisp_Object tail, msg; Lisp_Object tail, msg;
struct gcpro gcpro1, gcpro2; struct gcpro gcpro1, gcpro2;
Lisp_Object old_process_alist;
tail = Qnil; tail = Qnil;
msg = Qnil; msg = Qnil;
...@@ -3395,87 +3396,91 @@ status_notify () ...@@ -3395,87 +3396,91 @@ status_notify ()
reference. */ reference. */
GCPRO2 (tail, msg); GCPRO2 (tail, msg);
for (tail = Vprocess_alist; !NILP (tail); tail = Fcdr (tail)) do
{ {
Lisp_Object symbol; old_process_alist = Vprocess_alist;
register struct Lisp_Process *p; for (tail = Vprocess_alist; !NILP (tail); tail = Fcdr (tail))
proc = Fcdr (Fcar (tail));
p = XPROCESS (proc);
if (XINT (p->tick) != XINT (p->update_tick))
{ {
XSETINT (p->update_tick, XINT (p->tick)); Lisp_Object symbol;
register struct Lisp_Process *p;
/* If process is still active, read any output that remains. */ proc = Fcdr (Fcar (tail));
if (XINT (p->infd) >= 0) p = XPROCESS (proc);
while (! EQ (p->filter, Qt)
&& read_process_output (proc, XINT (p->infd)) > 0);
buffer = p->buffer; if (XINT (p->tick) != XINT (p->update_tick))
{
XSETINT (p->update_tick, XINT (p->tick));
/* Get the text to use for the message. */ /* If process is still active, read any output that remains. */
if (!NILP (p->raw_status_low)) if (XINT (p->infd) >= 0)
update_status (p); while (! EQ (p->filter, Qt)
msg = status_message (p->status); && read_process_output (proc, XINT (p->infd)) > 0);
/* If process is terminated, deactivate it or delete it. */ buffer = p->buffer;
symbol = p->status;
if (CONSP (p->status))
symbol = XCONS (p->status)->car;
if (EQ (symbol, Qsignal) || EQ (symbol, Qexit) /* Get the text to use for the message. */
|| EQ (symbol, Qclosed)) if (!NILP (p->raw_status_low))
{ update_status (p);
if (delete_exited_processes) msg = status_message (p->status);
remove_process (proc);
else
deactivate_process (proc);
}
/* Now output the message suitably. */ /* If process is terminated, deactivate it or delete it. */
if (!NILP (p->sentinel)) symbol = p->status;
exec_sentinel (proc, msg); if (CONSP (p->status))
/* Don't bother with a message in the buffer symbol = XCONS (p->status)->car;
when a process becomes runnable. */
else if (!EQ (symbol, Qrun) && !NILP (buffer))
{
Lisp_Object ro, tem;
struct buffer *old = current_buffer;
int opoint;
ro = XBUFFER (buffer)->read_only;
/* Avoid error if buffer is deleted if (EQ (symbol, Qsignal) || EQ (symbol, Qexit)
(probably that's why the process is dead, too) */ || EQ (symbol, Qclosed))
if (NILP (XBUFFER (buffer)->name)) {
continue; if (delete_exited_processes)
Fset_buffer (buffer); remove_process (proc);
opoint = point; else
/* Insert new output into buffer deactivate_process (proc);
at the current end-of-output marker, }
thus preserving logical ordering of input and output. */
if (XMARKER (p->mark)->buffer)
SET_PT (marker_position (p->mark));
else
SET_PT (ZV);
if (point <= opoint)
opoint += XSTRING (msg)->size + XSTRING (p->name)->size + 10;
tem = current_buffer->read_only;
current_buffer->read_only = Qnil;
insert_string ("\nProcess ");
Finsert (1, &p->name);
insert_string (" ");
Finsert (1, &msg);
current_buffer->read_only = tem;
Fset_marker (p->mark, make_number (point), p->buffer);
SET_PT (opoint); /* Now output the message suitably. */
set_buffer_internal (old); if (!NILP (p->sentinel))
exec_sentinel (proc, msg);
/* Don't bother with a message in the buffer
when a process becomes runnable. */
else if (!EQ (symbol, Qrun) && !NILP (buffer))
{
Lisp_Object ro, tem;
struct buffer *old = current_buffer;
int opoint;
ro = XBUFFER (buffer)->read_only;
/* Avoid error if buffer is deleted
(probably that's why the process is dead, too) */
if (NILP (XBUFFER (buffer)->name))
continue;
Fset_buffer (buffer);
opoint = point;
/* Insert new output into buffer
at the current end-of-output marker,
thus preserving logical ordering of input and output. */
if (XMARKER (p->mark)->buffer)
SET_PT (marker_position (p->mark));
else
SET_PT (ZV);
if (point <= opoint)
opoint += XSTRING (msg)->size + XSTRING (p->name)->size + 10;
tem = current_buffer->read_only;
current_buffer->read_only = Qnil;
insert_string ("\nProcess ");
Finsert (1, &p->name);
insert_string (" ");
Finsert (1, &msg);
current_buffer->read_only = tem;
Fset_marker (p->mark, make_number (point), p->buffer);
SET_PT (opoint);
set_buffer_internal (old);
}
} }
} } /* end for */
} /* end for */ } while (! EQ (old_process_alist, Vprocess_alist));
update_mode_lines++; /* in case buffers use %s in mode-line-format */ update_mode_lines++; /* in case buffers use %s in mode-line-format */
redisplay_preserve_echo_area (); redisplay_preserve_echo_area ();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment