changeset 16750:06001fb1a820

(read_char_x_menu_prompt): Unread and record all the input events from here. (record_menu_key): New subroutine.
author Richard M. Stallman <rms@gnu.org>
date Thu, 26 Dec 1996 21:00:03 +0000
parents c85f62b1b749
children d393cbcfb69c
files src/keyboard.c
diffstat 1 files changed, 52 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Thu Dec 26 20:55:04 1996 +0000
+++ b/src/keyboard.c	Thu Dec 26 21:00:03 1996 +0000
@@ -474,6 +474,8 @@
 
 extern char *x_get_keysym_name ();
 
+static void record_menu_key ();
+
 Lisp_Object Qpolling_period;
 
 /* List of absolute timers.  Appears in order of next scheduled event.  */
@@ -1902,7 +1904,14 @@
       /* Don't bring up a menu if we already have another event.  */
       && NILP (Vunread_command_events)
       && unread_command_char < 0)
-    c = read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu);
+    {
+      c = read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu);
+
+      /* Now that we have read an event, Emacs is not idle.  */
+      timer_stop_idle ();
+
+      return c;
+    }
 
   /* Maybe autosave and/or garbage collect due to idleness.  */
 
@@ -2214,6 +2223,39 @@
   return c;
 }
 
+/* Record a key that came from a mouse menu.
+   Record it for echoing, for this-command-keys, and so on.  */
+
+static void
+record_menu_key (c)
+     Lisp_Object c;
+{
+  /* Wipe the echo area.  */
+  echo_area_glyphs = 0;
+
+  record_char (c);
+
+  before_command_key_count = this_command_key_count;
+  before_command_echo_length = echo_length ();
+
+  /* Don't echo mouse motion events.  */
+  if (echo_keystrokes)
+    {
+      echo_char (c);
+
+      /* Once we reread a character, echoing can happen
+	 the next time we pause to read a new one.  */
+      ok_to_echo_at_next_pause = 0;
+    }
+
+  /* Record this character as part of the current key.  */
+  add_command_key (c);
+
+  /* Re-reading in the middle of a command */
+  last_input_char = c;
+  num_input_chars++;
+}
+
 /* Return 1 if should recognize C as "the help character".  */
 
 int
@@ -5374,6 +5416,8 @@
 	{
 	  Lisp_Object tem;
 
+	  record_menu_key (XCONS (value)->car);
+
 	  /* If we got multiple events, unread all but
 	     the first.
 	     There is no way to prevent those unread events
@@ -5384,10 +5428,13 @@
 	     they won't confuse things.  */
 	  for (tem = XCONS (value)->cdr; !NILP (tem);
 	       tem = XCONS (tem)->cdr)
-	    if (SYMBOLP (XCONS (tem)->car)
-		|| INTEGERP (XCONS (tem)->car))
-	      XCONS (tem)->car
-		= Fcons (XCONS (tem)->car, Qnil);
+	    {
+	      record_menu_key (XCONS (tem)->car);
+	      if (SYMBOLP (XCONS (tem)->car)
+		  || INTEGERP (XCONS (tem)->car))
+		XCONS (tem)->car
+		  = Fcons (XCONS (tem)->car, Qnil);
+	    }
 
 	  /* If we got more than one event, put all but the first
 	     onto this list to be read later.