changeset 71761:1055c0769159

* puresize.h (BASE_PURESIZE): Increment to 1211000. * dispnew.c (Fredisplay): New function, equivalent to (sit-for 0). (Fsit_for): Function deleted. * keyboard.c (command_loop_1, Fexecute_extended_command): Call sit_for instead of Fsit_for. * minibuf.c (temp_echo_area_glyphs): Likewise.
author Chong Yidong <cyd@stupidchicken.com>
date Mon, 10 Jul 2006 18:51:31 +0000
parents 68765d892dce
children f3f2486cf6bc
files src/ChangeLog src/dispnew.c src/keyboard.c src/minibuf.c src/puresize.h
diffstat 5 files changed, 61 insertions(+), 72 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon Jul 10 17:12:09 2006 +0000
+++ b/src/ChangeLog	Mon Jul 10 18:51:31 2006 +0000
@@ -1,3 +1,15 @@
+2006-07-10  Chong Yidong  <cyd@stupidchicken.com>
+
+	* puresize.h (BASE_PURESIZE): Increment to 1211000.
+
+	* dispnew.c (Fredisplay): New function, equivalent to (sit-for 0).
+	(Fsit_for): Function deleted.
+
+	* keyboard.c (command_loop_1, Fexecute_extended_command): Call
+	sit_for instead of Fsit_for.
+
+	* minibuf.c (temp_echo_area_glyphs): Likewise.
+
 2006-07-09  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* syntax.c (Fforward_comment): Revert the reversion.
--- a/src/dispnew.c	Mon Jul 10 17:12:09 2006 +0000
+++ b/src/dispnew.c	Mon Jul 10 18:51:31 2006 +0000
@@ -6495,10 +6495,7 @@
 
 
 /* This is just like wait_reading_process_output, except that
-   it does the redisplay.
-
-   It's also much like Fsit_for, except that it can be used for
-   waiting for input as well.  */
+   it does redisplay.  */
 
 Lisp_Object
 sit_for (sec, usec, reading, display, initial_display)
@@ -6535,56 +6532,20 @@
 }
 
 
-DEFUN ("sit-for", Fsit_for, Ssit_for, 1, 3, 0,
-       doc: /* Perform redisplay, then wait for SECONDS seconds or until input is available.
-SECONDS may be a floating-point value, meaning that you can wait for a
-fraction of a second.
-\(Not all operating systems support waiting for a fraction of a second.)
-Optional arg NODISP non-nil means don't redisplay, just wait for input.
-Redisplay is preempted as always if input arrives, and does not happen
-if input is available before it starts.
-Value is t if waited the full time with no input arriving.
-
-Redisplay will occur even when input is available if SECONDS is negative.
-
-An obsolete but still supported form is
-\(sit-for SECONDS &optional MILLISECONDS NODISP)
-Where the optional arg MILLISECONDS specifies an additional wait period,
-in milliseconds; this was useful when Emacs was built without
-floating point support.
-usage: (sit-for SECONDS &optional NODISP OLD-NODISP) */)
-
-/* The `old-nodisp' stuff is there so that the arglist has the correct
-   length.  Otherwise, `defdvice' will redefine it with fewer args.  */
-     (seconds, milliseconds, nodisp)
-     Lisp_Object seconds, milliseconds, nodisp;
+DEFUN ("redisplay", Fredisplay, Sredisplay, 0, 0, 0,
+       doc: /* Perform redisplay.
+If input is available before this starts, redisplay is preempted
+unless `redisplay-dont-pause' is non-nil.  */)
+     ()
 {
-  int sec, usec;
-
-  if (NILP (nodisp) && !NUMBERP (milliseconds))
-    { /* New style.  */
-      nodisp = milliseconds;
-      milliseconds = Qnil;
-    }
-
-  if (NILP (milliseconds))
-    XSETINT (milliseconds, 0);
-  else
-    CHECK_NUMBER (milliseconds);
-  usec = XINT (milliseconds) * 1000;
-
-  {
-    double duration = extract_float (seconds);
-    sec = (int) duration;
-    usec += (duration - sec) * 1000000;
-  }
-
-#ifndef EMACS_HAS_USECS
-  if (usec != 0 && sec == 0)
-    error ("Millisecond `sit-for' not supported on %s", SYSTEM_TYPE);
-#endif
-
-  return sit_for (sec, usec, 0, NILP (nodisp), NILP (nodisp));
+  swallow_events (Qt);
+  if ((detect_input_pending_run_timers (Qt)
+       && NILP (Qredisplay_dont_pause))
+      || !NILP (Vexecuting_kbd_macro))
+    return Qnil;
+
+  redisplay_preserve_echo_area (2);
+  return Qt;
 }
 
 
@@ -6974,7 +6935,7 @@
   defsubr (&Sframe_or_buffer_changed_p);
   defsubr (&Sopen_termscript);
   defsubr (&Sding);
-  defsubr (&Ssit_for);
+  defsubr (&Sredisplay);
   defsubr (&Ssleep_for);
   defsubr (&Ssend_string_to_terminal);
   defsubr (&Sinternal_show_cursor);
--- a/src/keyboard.c	Mon Jul 10 17:12:09 2006 +0000
+++ b/src/keyboard.c	Mon Jul 10 18:51:31 2006 +0000
@@ -1488,9 +1488,11 @@
 	  /* Bind inhibit-quit to t so that C-g gets read in
 	     rather than quitting back to the minibuffer.  */
 	  int count = SPECPDL_INDEX ();
+	  double duration = extract_float (Vminibuffer_message_timeout);
 	  specbind (Qinhibit_quit, Qt);
 
-	  Fsit_for (Vminibuffer_message_timeout, Qnil, Qnil);
+	  sit_for ((int) duration, (duration - (int) duration) * 1000000,
+		   0, Qt, Qt);
 	  /* Clear the echo area.  */
 	  message2 (0, 0, 0);
 	  safe_run_hooks (Qecho_area_clear_hook);
@@ -9880,19 +9882,26 @@
 				      Qmouse_movement)))
     {
       /* But first wait, and skip the message if there is input.  */
-      int delay_time;
+      Lisp_Object waited;
+
       if (!NILP (echo_area_buffer[0]))
-	/* This command displayed something in the echo area;
-	   so wait a few seconds, then display our suggestion message.  */
-	delay_time = (NUMBERP (Vsuggest_key_bindings)
-		      ? XINT (Vsuggest_key_bindings) : 2);
+	{
+	  /* This command displayed something in the echo area;
+	     so wait a few seconds, then display our suggestion message.  */
+	  if (NUMBERP (Vsuggest_key_bindings))
+	    {
+	      double duration = extract_float (Vminibuffer_message_timeout);
+	      waited = sit_for ((int) duration,
+				(duration - (int) duration) * 1000000,
+				0, Qt, Qt);
+	    }
+	  else
+	    waited = sit_for (2, 0, 0, Qt, Qt);
+	}
       else
-	/* This command left the echo area empty,
-	   so display our message immediately.  */
-	delay_time = 0;
-
-      if (!NILP (Fsit_for (make_number (delay_time), Qnil, Qnil))
-	  && ! CONSP (Vunread_command_events))
+	waited = sit_for (0, 0, 0, Qt, Qt);
+
+      if (!NILP (waited) && ! CONSP (Vunread_command_events))
 	{
 	  Lisp_Object binding;
 	  char *newmessage;
@@ -9912,10 +9921,17 @@
 	  message2_nolog (newmessage,
 			  strlen (newmessage),
 			  STRING_MULTIBYTE (binding));
-	  if (!NILP (Fsit_for ((NUMBERP (Vsuggest_key_bindings)
-				? Vsuggest_key_bindings : make_number (2)),
-			       Qnil, Qnil))
-	      && message_p)
+	  if (NUMBERP (Vsuggest_key_bindings))
+	    {
+	      double duration = extract_float (Vsuggest_key_bindings);
+	      waited = sit_for ((int) duration,
+				(duration - (int) duration) * 1000000,
+				0, Qt, Qt);
+	    }
+	  else
+	    waited = sit_for (2, 0, 0, Qt, Qt);
+
+	  if (!NILP (waited) && message_p)
 	    restore_message ();
 
 	  unbind_to (count, Qnil);
--- a/src/minibuf.c	Mon Jul 10 17:12:09 2006 +0000
+++ b/src/minibuf.c	Mon Jul 10 18:51:31 2006 +0000
@@ -2692,7 +2692,7 @@
   insert_from_string (string, 0, 0, SCHARS (string), SBYTES (string), 0);
   SET_PT_BOTH (opoint, opoint_byte);
   Vinhibit_quit = Qt;
-  Fsit_for (make_number (2), Qnil, Qnil);
+  sit_for (2, 0, 0, Qt, Qt);
   del_range_both (osize, osize_byte, ZV, ZV_BYTE, 1);
   SET_PT_BOTH (opoint, opoint_byte);
   if (!NILP (Vquit_flag))
--- a/src/puresize.h	Mon Jul 10 17:12:09 2006 +0000
+++ b/src/puresize.h	Mon Jul 10 18:51:31 2006 +0000
@@ -43,7 +43,7 @@
 #endif
 
 #ifndef BASE_PURESIZE
-#define BASE_PURESIZE (1210500 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA)
+#define BASE_PURESIZE (1211000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA)
 #endif
 
 /* Increase BASE_PURESIZE by a ratio depending on the machine's word size.  */