From 9d2b8e768f2015a89f7609dedf7b28ea5e8123b5 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 11 Dec 2015 11:53:53 +0200 Subject: [PATCH] Fix 'this-command-keys' wrt prefix argument * src/keyboard.c (command_loop_1): Restore the feature whereby C-u was part of this-command-keys, but not of this-single-command-keys. (Bug#22107) * lisp/simple.el (internal-echo-keystrokes-prefix): Add commentary about the function's return value. --- lisp/simple.el | 4 +++- src/keyboard.c | 13 ++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index 17b9c918ead..9e0388efe45 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3818,7 +3818,9 @@ see other processes running on the system, use `list-system-processes'." (setq prefix-command--last-echo nil) (defun internal-echo-keystrokes-prefix () - ;; BEWARE: Called directly from the C code. + ;; BEWARE: Called directly from C code. + ;; If the return value is non-nil, it means we are in the middle of + ;; a command with prefix, such as a command invoked with prefix-arg. (if (not prefix-command--needs-update) prefix-command--last-echo (setq prefix-command--last-echo diff --git a/src/keyboard.c b/src/keyboard.c index 02bc7d2a0b7..928d8496cdb 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1486,11 +1486,14 @@ command_loop_1 (void) if (!CONSP (last_command_event)) kset_last_repeatable_command (current_kboard, Vreal_this_command); - this_command_key_count = 0; - this_single_command_key_start = 0; - - if (current_kboard->immediate_echo - && !NILP (call0 (Qinternal_echo_keystrokes_prefix))) + /* Don't reset this_command_key_count if we've processed + prefix-arg. */ + if (NILP (call0 (Qinternal_echo_keystrokes_prefix))) + { + this_command_key_count = 0; + this_single_command_key_start = 0; + } + else if (current_kboard->immediate_echo) { current_kboard->immediate_echo = false; /* Refresh the echo message. */ -- 2.39.2