changeset 15064:fb0f2804c34a

(wait_reading_process_input, both definitions): If wait_for_cell, don't call timer_check, and use detect_input_pending instead of detect_input_pending_run_timers.
author Richard M. Stallman <rms@gnu.org>
date Tue, 23 Apr 1996 20:32:33 +0000
parents dc10bb3b05e2
children 270020829d09
files src/process.c
diffstat 1 files changed, 36 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/process.c	Tue Apr 23 15:30:28 1996 +0000
+++ b/src/process.c	Tue Apr 23 20:32:33 1996 +0000
@@ -2078,11 +2078,11 @@
 	  EMACS_SET_SECS_USECS (timeout, 100000, 0);
 	}
 
-      /* If our caller will not immediately handle keyboard events,
-	 run timer events directly.
-	 (Callers that will immediately read keyboard events
-	 call timer_delay on their own.)  */
-      if (1)
+      /* Normally we run timers here.
+	 But not if wait_for_cell; in those cases,
+	 the wait is supposed to be short,
+	 and those callers cannot handle running arbitrary Lisp code here.  */
+      if (! wait_for_cell)
 	{
 	  EMACS_TIME timer_delay;
 	  int old_timers_run;
@@ -2248,7 +2248,7 @@
       /* If there is any, return immediately
 	 to give it higher priority than subprocesses */
 
-      if ((XINT (read_kbd) != 0 || wait_for_cell)
+      if ((XINT (read_kbd) != 0)
 	  && detect_input_pending_run_timers (do_display))
 	{
 	  swallow_events (do_display);
@@ -2256,6 +2256,20 @@
 	    break;
 	}
 
+      /* If wait_for_cell. check for keyboard input
+	 but don't run any timers.
+	 ??? (It seems wrong to me to check for keyboard
+	 input at all when wait_for_cell, but the code
+	 has been this way since July 1994.
+	 Try changing this after version 19.31.)  */
+      if (wait_for_cell
+	  && detect_input_pending ())
+	{
+	  swallow_events (do_display);
+	  if (detect_input_pending ())
+	    break;
+	}
+
       /* Exit now if the cell we're waiting for became non-nil.  */
       if (wait_for_cell && ! NILP (*wait_for_cell))
 	break;
@@ -3903,7 +3917,7 @@
 	 run timer events directly.
 	 (Callers that will immediately read keyboard events
 	 call timer_delay on their own.)  */
-      if (1)
+      if (! wait_for_cell)
 	{
 	  EMACS_TIME timer_delay;
 	  int old_timers_run;
@@ -3995,7 +4009,7 @@
 
       /* Check for keyboard input */
 
-      if ((XINT (read_kbd) != 0 || wait_for_cell)
+      if ((XINT (read_kbd) != 0)
 	  && detect_input_pending_run_timers (do_display))
 	{
 	  swallow_events (do_display);
@@ -4003,6 +4017,20 @@
 	    break;
 	}
 
+      /* If wait_for_cell. check for keyboard input
+	 but don't run any timers.
+	 ??? (It seems wrong to me to check for keyboard
+	 input at all when wait_for_cell, but the code
+	 has been this way since July 1994.
+	 Try changing this after version 19.31.)  */
+      if (wait_for_cell
+	  && detect_input_pending ())
+	{
+	  swallow_events (do_display);
+	  if (detect_input_pending ())
+	    break;
+	}
+
       /* Exit now if the cell we're waiting for became non-nil.  */
       if (wait_for_cell && ! NILP (*wait_for_cell))
 	break;