diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2019-08-05 12:43:09 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2019-08-05 12:43:17 +0200 |
commit | 1abf76877847226daa5ab7e07000ac1d4aba3478 (patch) | |
tree | 26f3a04bcb8d2e8fa085b4a528ff77443df727b0 /lisp/help.el | |
parent | f1f6f20ca0a3e3190defa79bcfcc59eb6aa3b4dc (diff) | |
download | emacs-1abf76877847226daa5ab7e07000ac1d4aba3478.tar.gz |
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 'lisp/help.el')
-rw-r--r-- | lisp/help.el | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/lisp/help.el b/lisp/help.el index 039d0c44e4f..ba76d267571 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -465,18 +465,28 @@ To record all your input, use `open-dribble-file'." (help-setup-xref (list #'view-lossage) (called-interactively-p 'interactive)) (with-help-window (help-buffer) - (princ " ") - (princ (mapconcat (lambda (key) - (cond - ((and (consp key) (null (car key))) - (format ";; %s\n" (if (symbolp (cdr key)) (cdr key) - "anonymous-command"))) - ((or (integerp key) (symbolp key) (listp key)) - (single-key-description key)) - (t - (prin1-to-string key nil)))) - (recent-keys 'include-cmds) - " ")) + (with-current-buffer standard-output + (let ((prev-command nil)) + (mapc + (lambda (key) + (cond + ((and (consp key) (null (car key))) + (princ (format ";; %s\n" + (setq prev-command + (if (symbolp (cdr key)) + (cdr key) + "anonymous-command"))))) + ((eq key 'end-of-command) + (unless (bolp) + (princ (format ";; <during %s>\n" (or prev-command + "unknown command"))))) + ((or (integerp key) (symbolp key) (listp key)) + (princ (single-key-description key)) + (princ " ")) + (t + (prin1 key) + (princ " ")))) + (recent-keys 'include-cmds)))) (with-current-buffer standard-output (goto-char (point-min)) (let ((comment-start ";; ") |