]> code.delx.au - gnu-emacs/blobdiff - src/keyboard.c
(menu_bar_items, tool_bar_items):
[gnu-emacs] / src / keyboard.c
index b23e08959e4a3f560cc73641067605b099aae3ea..13b93fb390ee383e4f77137a6e7e771700f8c47a 100644 (file)
@@ -2894,18 +2894,43 @@ record_char (c)
   Lisp_Object help;
 
   /* Don't record `help-echo' in recent_keys unless it shows some help
-     message.  */
-  if (!CONSP (c)
-      || !EQ (XCAR (c), Qhelp_echo)
-      || (help = Fnth (make_number (2), c),
-         !NILP (help)))
+     message, and a different help than the previoiusly recorded
+     event.  */
+  if (CONSP (c) && EQ (XCAR (c), Qhelp_echo))
+    {
+      Lisp_Object help;
+
+      help = Fnth (make_number (2), c);
+      if (STRINGP (help))
+       {
+         int last_idx;
+         Lisp_Object last_c, last_help;
+         
+         last_idx = recent_keys_index - 1;
+         if (last_idx < 0)
+           last_idx = NUM_RECENT_KEYS - 1;
+         last_c = AREF (recent_keys, last_idx);
+         
+         if (!CONSP (last_c)
+             || !EQ (XCAR (last_c), Qhelp_echo)
+             || (last_help = Fnth (make_number (2), last_c),
+                 !EQ (last_help, help)))
+           {
+             total_keys++;
+             ASET (recent_keys, recent_keys_index, c);
+             if (++recent_keys_index >= NUM_RECENT_KEYS)
+               recent_keys_index = 0;
+           }
+       }
+    }
+  else
     {
       total_keys++;
       ASET (recent_keys, recent_keys_index, c);
       if (++recent_keys_index >= NUM_RECENT_KEYS)
        recent_keys_index = 0;
     }
-
+      
   /* Write c to the dribble file.  If c is a lispy event, write
      the event's symbol to the dribble file, in <brackets>.  Bleaugh.
      If you, dear reader, have a better idea, you've got the source.  :-) */
@@ -6281,8 +6306,8 @@ menu_bar_items (old)
   for (mapno = nmaps - 1; mapno >= 0; mapno--)
     if (!NILP (maps[mapno]))
       {
-       def = get_keymap (access_keymap (maps[mapno], Qmenu_bar, 1, 0, 0),
-                         0, 0);
+       def = get_keymap (access_keymap (maps[mapno], Qmenu_bar, 1, 0, 1),
+                         0, 1);
        if (CONSP (def))
          menu_bar_one_keymap (def);
       }
@@ -6934,8 +6959,7 @@ tool_bar_items (reuse, nitems)
       {
        Lisp_Object keymap;
 
-       /* Why set the `noinherit' flag ?  -sm  */
-       keymap = get_keymap (access_keymap (maps[i], Qtool_bar, 1, 1, 0), 0, 0);
+       keymap = get_keymap (access_keymap (maps[i], Qtool_bar, 1, 0, 1), 0, 1);
        if (CONSP (keymap))
          {
            Lisp_Object tail;