all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 21867@debbugs.gnu.org, zkanfer@gmail.com
Subject: bug#21867: 25.0.50; lossage's log doesn't treat characters read by read-char as separate commands
Date: Fri, 02 Aug 2019 13:19:01 +0200	[thread overview]
Message-ID: <8736ijak7u.fsf@mouse.gnus.org> (raw)
In-Reply-To: <83ef24gjby.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 02 Aug 2019 09:41:37 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

> Or maybe a special symbol?

The following patch does this.  Does this look like the thing to do?

The test case, with this patch, now looks like this:

 C-e			;; move-end-of-line
 C-x C-e		;; eval-last-sexp
 a 			;; 
 C-h l			;; view-lossage

I've looked at other in-tree usages of `recent-keys', and it doesn't
look like this should affect anything else.

diff --git a/lisp/help.el b/lisp/help.el
index 039d0c44e4..0cd2aecba5 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -471,6 +471,9 @@ view-lossage
 			 ((and (consp key) (null (car key)))
 			  (format ";; %s\n" (if (symbolp (cdr key)) (cdr key)
 					      "anonymous-command")))
+                         ((eq key 'non-command-character)
+                          ;; This comes from `read-char'.
+                          "\n")
 			 ((or (integerp key) (symbolp key) (listp key))
 			  (single-key-description key))
 			 (t
diff --git a/src/keyboard.c b/src/keyboard.c
index db5ca4e547..4e13bec5dd 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2091,7 +2091,6 @@ show_help_echo (Lisp_Object help, Lisp_Object window, Lisp_Object object,
 
 static Lisp_Object kbd_buffer_get_event (KBOARD **kbp, bool *used_mouse_menu,
 					 struct timespec *end_time);
-static void record_char (Lisp_Object c);
 
 static Lisp_Object help_form_saved_window_configs;
 static void
@@ -3192,7 +3191,7 @@ help_char_p (Lisp_Object c)
 
 /* Record the input event C in various ways.  */
 
-static void
+void
 record_char (Lisp_Object c)
 {
   /* quail.el binds this to avoid recording keys twice.  */
@@ -11069,6 +11068,8 @@ syms_of_keyboard (void)
 
   DEFSYM (Qundefined, "undefined");
 
+  DEFSYM (Qnon_command_character, "non-command-character");
+
   /* Hooks to run before and after each command.  */
   DEFSYM (Qpre_command_hook, "pre-command-hook");
   DEFSYM (Qpost_command_hook, "post-command-hook");
diff --git a/src/lisp.h b/src/lisp.h
index f437609fe1..ef03935b7a 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -4375,6 +4375,7 @@ fast_string_match_ignore_case (Lisp_Object regexp, Lisp_Object string)
 extern void init_keyboard (void);
 extern void syms_of_keyboard (void);
 extern void keys_of_keyboard (void);
+extern void record_char (Lisp_Object);
 
 /* Defined in indent.c.  */
 extern ptrdiff_t current_column (void);
diff --git a/src/lread.c b/src/lread.c
index eec88760d4..88a27531eb 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -679,8 +679,11 @@ read_filtered_event (bool no_switch_frame, bool ascii_required,
   /* Read until we get an acceptable event.  */
  retry:
   do
-    val = read_char (0, Qnil, (input_method ? Qnil : Qt), 0,
-		     NUMBERP (seconds) ? &end_time : NULL);
+    {
+      val = read_char (0, Qnil, (input_method ? Qnil : Qt), 0,
+		       NUMBERP (seconds) ? &end_time : NULL);
+      record_char (Qnon_command_character);
+    }
   while (FIXNUMP (val) && XFIXNUM (val) == -2); /* wrong_kboard_jmpbuf */
 
   if (BUFFERP (val))

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2019-08-02 11:19 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-09  4:58 bug#21867: 25.0.50; lossage's log doesn't treat characters read by read-char as separate commands Zachary Kanfer
2019-08-01 18:05 ` Lars Ingebrigtsen
2019-08-01 18:21   ` Eli Zaretskii
2019-08-01 18:41     ` Lars Ingebrigtsen
2019-08-01 18:51       ` Eli Zaretskii
2019-08-01 18:58         ` Lars Ingebrigtsen
2019-08-01 19:18           ` Eli Zaretskii
2019-08-01 19:25             ` Lars Ingebrigtsen
2019-08-02  6:41               ` Eli Zaretskii
2019-08-02 11:19                 ` Lars Ingebrigtsen [this message]
2019-08-02 12:02                   ` Eli Zaretskii
2019-08-02 20:16                   ` Stefan Monnier
2019-08-03 12:13                     ` Lars Ingebrigtsen
2019-08-03 21:07                       ` Stefan Monnier
2019-08-03 21:14                         ` Lars Ingebrigtsen
2019-08-03 21:49                           ` Juri Linkov
2019-08-04 11:45                             ` Lars Ingebrigtsen
2019-08-04 21:04                               ` Juri Linkov
2019-08-04 12:54                             ` Stefan Monnier
2019-08-04 19:44                               ` Juri Linkov
2019-08-05 18:36                                 ` Stefan Monnier
2019-08-07 18:31                                   ` Lars Ingebrigtsen
2019-08-23  1:41                                     ` Lars Ingebrigtsen
2019-08-05  9:15                               ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8736ijak7u.fsf@mouse.gnus.org \
    --to=larsi@gnus.org \
    --cc=21867@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=zkanfer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.