Subject: bug#62626: 29.0.60; describe-key errors on Edit → Paste from Kill Ring → [any item]

From: Eli Zaretskii <[email-masked]>
Date: Sat, 08 Apr 2023 15:43:43 +0300

> From: Stefan Monnier <[email-masked]>
> Cc: Spencer Baugh <[email-masked]>,  [email-masked]
> Date: Thu, 06 Apr 2023 10:07:47 -0400
> 
> > An alternative solution for the original problem would be to teach
> > event-basic-type and event-modifiers about "events" that happen to be
> > strings.
> 
> Since `read-key-sequence` returns those, we should probably teach
> `event-*` functions to deal with them.

Done.

> But since they don't agree with `eventp`, maybe we should also consider
> deprecating such "weird keys".

Patches welcome (and this is not for the release branch anyway).

> FWIW, that very same "Paste from Kill Menu" is constructed differently in
> `context-menu-region` where it doesn't suffer from this problem (it
> uses integers instead of strings, as keys).

Aren't those integer indices the reason why the recipe below:

  emacs -Q
  M-x context-menu-mode RET
  Type "foobar" and kill it
  C-h k and right click, then "Paste from Kill Menu", then select string
  Observe the help buffer claims the key sequence was:
    <down-mouse-3> <paste-from-menu> C-a
                                     ^^^
shows the bogus "C-a" at the end of the sequence?  I believe C-a comes
from the index 1 that read-key-sequence returns at the end of the
sequence:

  [(down-mouse-3 (#<window 3 on *scratch*> 146 (422 . 257) 1959895390 nil 146 (52 . 3) nil (422 . 209) (8 . 16))) paste-from-menu 1]