summaryrefslogtreecommitdiff
path: root/src/process.c
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1995-05-18 16:54:42 +0000
committerKarl Heuer <kwzh@gnu.org>1995-05-18 16:54:42 +0000
commit218886207a6fe9f4bedbe45a4ae11c39be54c438 (patch)
treef24bbf5f105755162fd23e4f49b347dcfa891fce /src/process.c
parent0179949f255a7bf0754c393dabb4c745ad6555aa (diff)
downloademacs-218886207a6fe9f4bedbe45a4ae11c39be54c438.tar.gz
(status_notify): If Vprocess_alist changes within
the loop, do the whole loop again.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c145
1 files changed, 75 insertions, 70 deletions
diff --git a/src/process.c b/src/process.c
index 119ed47c749..cedcb38fa8a 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3386,6 +3386,7 @@ status_notify ()
register Lisp_Object proc, buffer;
Lisp_Object tail, msg;
struct gcpro gcpro1, gcpro2;
+ Lisp_Object old_process_alist;
tail = Qnil;
msg = Qnil;
@@ -3395,87 +3396,91 @@ status_notify ()
reference. */
GCPRO2 (tail, msg);
- for (tail = Vprocess_alist; !NILP (tail); tail = Fcdr (tail))
+ do
{
- Lisp_Object symbol;
- register struct Lisp_Process *p;
-
- proc = Fcdr (Fcar (tail));
- p = XPROCESS (proc);
-
- if (XINT (p->tick) != XINT (p->update_tick))
+ old_process_alist = Vprocess_alist;
+ for (tail = Vprocess_alist; !NILP (tail); tail = Fcdr (tail))
{
- 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. */
- if (XINT (p->infd) >= 0)
- while (! EQ (p->filter, Qt)
- && read_process_output (proc, XINT (p->infd)) > 0);
+ proc = Fcdr (Fcar (tail));
+ p = XPROCESS (proc);
- 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 (!NILP (p->raw_status_low))
- update_status (p);
- msg = status_message (p->status);
+ /* If process is still active, read any output that remains. */
+ if (XINT (p->infd) >= 0)
+ while (! EQ (p->filter, Qt)
+ && read_process_output (proc, XINT (p->infd)) > 0);
- /* If process is terminated, deactivate it or delete it. */
- symbol = p->status;
- if (CONSP (p->status))
- symbol = XCONS (p->status)->car;
+ buffer = p->buffer;
- if (EQ (symbol, Qsignal) || EQ (symbol, Qexit)
- || EQ (symbol, Qclosed))
- {
- if (delete_exited_processes)
- remove_process (proc);
- else
- deactivate_process (proc);
- }
+ /* Get the text to use for the message. */
+ if (!NILP (p->raw_status_low))
+ update_status (p);
+ msg = status_message (p->status);
- /* Now output the message suitably. */
- 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;
+ /* If process is terminated, deactivate it or delete it. */
+ symbol = p->status;
+ if (CONSP (p->status))
+ symbol = XCONS (p->status)->car;
- /* 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);
+ if (EQ (symbol, Qsignal) || EQ (symbol, Qexit)
+ || EQ (symbol, Qclosed))
+ {
+ if (delete_exited_processes)
+ remove_process (proc);
+ else
+ deactivate_process (proc);
+ }
- SET_PT (opoint);
- set_buffer_internal (old);
+ /* Now output the message suitably. */
+ 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 */
redisplay_preserve_echo_area ();