aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2016-02-15 14:03:57 +0200
committerEli Zaretskii2016-02-15 14:03:57 +0200
commitd9ea795035f28f700f1456b377013a24a1ea5e6f (patch)
tree84785904ae4ff9507357c351169277a68b074306 /src
parent903603f8cd06c289ae84bf3f0bc8ac43609b6644 (diff)
downloademacs-d9ea795035f28f700f1456b377013a24a1ea5e6f.tar.gz
emacs-d9ea795035f28f700f1456b377013a24a1ea5e6f.zip
Fix regression with 'recent-keys' and keyboard macros
* src/keyboard.c (record_char): Don't record in 'recent_keys' events that come from executing keyboard macros. (Bug#22674)
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c50
1 files changed, 27 insertions, 23 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 546c0128328..4edb5aa0f32 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -3220,33 +3220,37 @@ record_char (Lisp_Object c)
3220 else 3220 else
3221 store_kbd_macro_char (c); 3221 store_kbd_macro_char (c);
3222 3222
3223 if (!recorded) 3223 /* recent_keys should not include events from keyboard macros. */
3224 { 3224 if (NILP (Vexecuting_kbd_macro))
3225 total_keys += total_keys < NUM_RECENT_KEYS;
3226 ASET (recent_keys, recent_keys_index, c);
3227 if (++recent_keys_index >= NUM_RECENT_KEYS)
3228 recent_keys_index = 0;
3229 }
3230 else if (recorded < 0)
3231 { 3225 {
3232 /* We need to remove one or two events from recent_keys. 3226 if (!recorded)
3233 To do this, we simply put nil at those events and move the
3234 recent_keys_index backwards over those events. Usually,
3235 users will never see those nil events, as they will be
3236 overwritten by the command keys entered to see recent_keys
3237 (e.g. C-h l). */
3238
3239 while (recorded++ < 0 && total_keys > 0)
3240 { 3227 {
3241 if (total_keys < NUM_RECENT_KEYS) 3228 total_keys += total_keys < NUM_RECENT_KEYS;
3242 total_keys--; 3229 ASET (recent_keys, recent_keys_index, c);
3243 if (--recent_keys_index < 0) 3230 if (++recent_keys_index >= NUM_RECENT_KEYS)
3244 recent_keys_index = NUM_RECENT_KEYS - 1; 3231 recent_keys_index = 0;
3245 ASET (recent_keys, recent_keys_index, Qnil); 3232 }
3233 else if (recorded < 0)
3234 {
3235 /* We need to remove one or two events from recent_keys.
3236 To do this, we simply put nil at those events and move the
3237 recent_keys_index backwards over those events. Usually,
3238 users will never see those nil events, as they will be
3239 overwritten by the command keys entered to see recent_keys
3240 (e.g. C-h l). */
3241
3242 while (recorded++ < 0 && total_keys > 0)
3243 {
3244 if (total_keys < NUM_RECENT_KEYS)
3245 total_keys--;
3246 if (--recent_keys_index < 0)
3247 recent_keys_index = NUM_RECENT_KEYS - 1;
3248 ASET (recent_keys, recent_keys_index, Qnil);
3249 }
3246 } 3250 }
3247 }
3248 3251
3249 num_nonmacro_input_events++; 3252 num_nonmacro_input_events++;
3253 }
3250 3254
3251 /* Write c to the dribble file. If c is a lispy event, write 3255 /* Write c to the dribble file. If c is a lispy event, write
3252 the event's symbol to the dribble file, in <brackets>. Bleaugh. 3256 the event's symbol to the dribble file, in <brackets>. Bleaugh.