From: Gerd Moellmann Date: Tue, 5 Dec 2000 17:03:51 +0000 (+0000) Subject: (record_char): Don't record identical help-echo X-Git-Tag: emacs-pretest-21.0.93~206 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=52be17cc7111b281eceb17aae0c0adad307d51c9;p=emacs.git (record_char): Don't record identical help-echo events in recent_keys. --- diff --git a/src/ChangeLog b/src/ChangeLog index 39b0f4f7fb4..93914d08815 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2000-12-05 Gerd Moellmann + * 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. diff --git a/src/keyboard.c b/src/keyboard.c index b23e08959e4..26d35936316 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -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 . Bleaugh. If you, dear reader, have a better idea, you've got the source. :-) */