diff options
| author | Lars Ingebrigtsen | 2019-08-05 12:43:09 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-08-05 12:43:17 +0200 |
| commit | 1abf76877847226daa5ab7e07000ac1d4aba3478 (patch) | |
| tree | 26f3a04bcb8d2e8fa085b4a528ff77443df727b0 /src | |
| parent | f1f6f20ca0a3e3190defa79bcfcc59eb6aa3b4dc (diff) | |
| download | emacs-1abf76877847226daa5ab7e07000ac1d4aba3478.tar.gz emacs-1abf76877847226daa5ab7e07000ac1d4aba3478.zip | |
Make `view-lossage' output of chars read from `read-char' more logical
* lisp/help.el (view-lossage): Use the new data format to output
data from `read-char' and the like in a more understandable
fashion (bug#21867).
* src/keyboard.c (command_loop_1): Record (in recent_keys) the end
of commands.
(Frecent_keys): Don't include `end-of-command' in non-command outputs.
(syms_of_keyboard): Define `end-of-command'.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 30686a25898..158daba260c 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -307,6 +307,7 @@ static Lisp_Object command_loop (void); | |||
| 307 | 307 | ||
| 308 | static void echo_now (void); | 308 | static void echo_now (void); |
| 309 | static ptrdiff_t echo_length (void); | 309 | static ptrdiff_t echo_length (void); |
| 310 | static void record_char (Lisp_Object c); | ||
| 310 | 311 | ||
| 311 | /* Incremented whenever a timer is run. */ | 312 | /* Incremented whenever a timer is run. */ |
| 312 | unsigned timers_run; | 313 | unsigned timers_run; |
| @@ -1421,6 +1422,8 @@ command_loop_1 (void) | |||
| 1421 | Fcons (Qnil, cmd)); | 1422 | Fcons (Qnil, cmd)); |
| 1422 | if (++recent_keys_index >= NUM_RECENT_KEYS) | 1423 | if (++recent_keys_index >= NUM_RECENT_KEYS) |
| 1423 | recent_keys_index = 0; | 1424 | recent_keys_index = 0; |
| 1425 | /* Mark this as a complete command in recent_keys. */ | ||
| 1426 | record_char (Qend_of_command); | ||
| 1424 | } | 1427 | } |
| 1425 | Vthis_command = cmd; | 1428 | Vthis_command = cmd; |
| 1426 | Vreal_this_command = cmd; | 1429 | Vreal_this_command = cmd; |
| @@ -1471,6 +1474,9 @@ command_loop_1 (void) | |||
| 1471 | 1474 | ||
| 1472 | safe_run_hooks (Qpost_command_hook); | 1475 | safe_run_hooks (Qpost_command_hook); |
| 1473 | 1476 | ||
| 1477 | /* Mark this as a complete command in recent_keys. */ | ||
| 1478 | record_char (Qend_of_command); | ||
| 1479 | |||
| 1474 | /* If displaying a message, resize the echo area window to fit | 1480 | /* If displaying a message, resize the echo area window to fit |
| 1475 | that message's size exactly. Do this only if the echo area | 1481 | that message's size exactly. Do this only if the echo area |
| 1476 | window is the minibuffer window of the selected frame. See | 1482 | window is the minibuffer window of the selected frame. See |
| @@ -2089,7 +2095,6 @@ show_help_echo (Lisp_Object help, Lisp_Object window, Lisp_Object object, | |||
| 2089 | 2095 | ||
| 2090 | static Lisp_Object kbd_buffer_get_event (KBOARD **kbp, bool *used_mouse_menu, | 2096 | static Lisp_Object kbd_buffer_get_event (KBOARD **kbp, bool *used_mouse_menu, |
| 2091 | struct timespec *end_time); | 2097 | struct timespec *end_time); |
| 2092 | static void record_char (Lisp_Object c); | ||
| 2093 | 2098 | ||
| 2094 | static Lisp_Object help_form_saved_window_configs; | 2099 | static Lisp_Object help_form_saved_window_configs; |
| 2095 | static void | 2100 | static void |
| @@ -9996,7 +10001,9 @@ represented as pseudo-events of the form (nil . COMMAND). */) | |||
| 9996 | do | 10001 | do |
| 9997 | { | 10002 | { |
| 9998 | Lisp_Object e = AREF (recent_keys, i); | 10003 | Lisp_Object e = AREF (recent_keys, i); |
| 9999 | if (cmds || !CONSP (e) || !NILP (XCAR (e))) | 10004 | if (cmds |
| 10005 | || ((!CONSP (e) || !NILP (XCAR (e))) | ||
| 10006 | && !EQ (e, Qend_of_command))) | ||
| 10000 | es = Fcons (e, es); | 10007 | es = Fcons (e, es); |
| 10001 | if (++i >= NUM_RECENT_KEYS) | 10008 | if (++i >= NUM_RECENT_KEYS) |
| 10002 | i = 0; | 10009 | i = 0; |
| @@ -11066,6 +11073,8 @@ syms_of_keyboard (void) | |||
| 11066 | 11073 | ||
| 11067 | DEFSYM (Qundefined, "undefined"); | 11074 | DEFSYM (Qundefined, "undefined"); |
| 11068 | 11075 | ||
| 11076 | DEFSYM (Qend_of_command, "end-of-command"); | ||
| 11077 | |||
| 11069 | /* Hooks to run before and after each command. */ | 11078 | /* Hooks to run before and after each command. */ |
| 11070 | DEFSYM (Qpre_command_hook, "pre-command-hook"); | 11079 | DEFSYM (Qpre_command_hook, "pre-command-hook"); |
| 11071 | DEFSYM (Qpost_command_hook, "post-command-hook"); | 11080 | DEFSYM (Qpost_command_hook, "post-command-hook"); |