]> git.eshelyaron.com Git - emacs.git/commitdiff
(record_char): Don't record identical help-echo
authorGerd Moellmann <gerd@gnu.org>
Tue, 5 Dec 2000 17:03:51 +0000 (17:03 +0000)
committerGerd Moellmann <gerd@gnu.org>
Tue, 5 Dec 2000 17:03:51 +0000 (17:03 +0000)
events in recent_keys.

src/ChangeLog
src/keyboard.c

index 39b0f4f7fb414d492097a3048661ee076b077811..93914d0881579dee0cf8dd94344e2987fcaab090 100644 (file)
@@ -1,5 +1,8 @@
 2000-12-05  Gerd Moellmann  <gerd@gnu.org>
 
+       * keyboard.c (record_char): Don't record identical help-echo
+       events in recent_keys.
+
        * xterm.c [USE_X_TOOLKIT]: Close the display.
        (xim_close_dpy): Handle case that the display has been closed.
 
index b23e08959e4a3f560cc73641067605b099aae3ea..26d35936316965518e0df65915d0343b4a353915 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.  :-) */