GNU bug report logs - #21867
25.0.50; lossage's log doesn't treat characters read by read-char as separate commands

Previous Next

Package: emacs;

Reported by: Zachary Kanfer <zkanfer <at> gmail.com>

Date: Mon, 9 Nov 2015 04:59:01 UTC

Severity: minor

Tags: confirmed

Found in version 25.0.50

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Zachary Kanfer <zkanfer <at> gmail.com>
Cc: 21867 <at> debbugs.gnu.org
Subject: bug#21867: 25.0.50; lossage's log doesn't treat characters read by read-char as separate commands
Date: Thu, 01 Aug 2019 20:05:29 +0200
Zachary Kanfer <zkanfer <at> gmail.com> writes:

> The way that lossage now shows different commands on different lines is
> really useful, but I found a way where it's not treating two different
> things as different commands. To reproduce:
>
> emacs -Q
>
> open the scratch buffer
>
> insert this whole s-expression:
>
> (read-char)
>
> Then, with point at the end of that line, type:
>
> C-x C-e a C-h l
>
> This evaluates the (read-char) sexp which reads the `a` typed, then
> views lossage.
>
> The last lines of lossage are:
>
>  C-x C-e [eval-last-sexp]
>  a C-h l [view-lossage]
>
> Note that the log line calling view-lossage also includes "a", the
> command read by read-char. I would expect the lossage buffer to be
> something like this:
>
>  C-x C-e [eval-last-sexp]
>  a [char read by read-char]
>  C-h l [view-lossage]
>
> This does not happen with read-string; one gets logs like:
>
>  C-x C-e [eval-last-sexp]
>  p [self-insert-command]
>  a [self-insert-command]
>  n [self-insert-command]
>  t [self-insert-command]
>  s [self-insert-command]
>  <return> [exit-minibuffer]
>  C-h l [view-lossage]

(I'm going through old bug reports that have unfortunately not gotten
any responses.)

I'm seeing the same thing in Emacs 27 -- C-x C-e on the `(read-char)'
and then a couple of <down>s:

 C-x C-e		;; eval-last-sexp
 a <down>		;; next-line
 <down>			;; next-line

This is what's returned by `recent-keys':

 24 5
 (nil . eval-last-sexp)
 97 down
 (nil . next-line)
 down
 (nil . next-line)

97 is the ?a.

The reason is that `read-char' does this:

  /* Store these characters into recent_keys, the dribble file if any,
     and the keyboard macro being defined, if any.  */
  record_char (c);
  recorded = true;
  if (! NILP (also_record))
    record_char (also_record);

But...  it's not clear what `read-char' should put into recent_keys
here, which is a not-very-clear structure.  Perhaps (nil . "char read by
read-char") after the char and then adjust `view-lossage'?

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




This bug report was last modified 5 years and 297 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.