GNU bug report logs - #66755
30.0.50; how do i lookup a key but also respect key translations?

Previous Next

Package: emacs;

Reported by: StrawberryTea <look <at> strawberrytea.xyz>

Date: Thu, 26 Oct 2023 04:13:02 UTC

Severity: normal

Tags: notabug

Found in version 30.0.50

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 66755 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: StrawberryTea <look <at> strawberrytea.xyz>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 66755 <at> debbugs.gnu.org
Subject: Re: bug#66755: 30.0.50;
 how do i lookup a key but also respect key translations?
Date: Thu, 26 Oct 2023 10:22:08 +0300
> From: StrawberryTea <look <at> strawberrytea.xyz>
> Date: Wed, 25 Oct 2023 22:57:58 -0500
> 
> 
> Hello. So I am trying to define a function which obtains the command
> that would be called if 'corfu-mode' was not enabled:
> 
> (defun +corfu--get-passthrough-command ()
>   (keymap-lookup
>    (thread-last
>      (current-active-maps t)
>      (delq corfu-map)
>      (delq (and (featurep 'evil)
>                 (evil-get-auxiliary-keymap corfu-map evil-state))))
>    (key-description (this-command-keys-vector))))
> 
> But the issue is basically that
> 
> (keymap-lookup (current-active-maps t)
>     (key-description (vector 'backspace)))
> 
> returns nil whereas
> 
> (keymap-lookup (current-active-maps t) (key-description (vector ?\C-?)))
> 
> returns 'lispy-delete-backward' which is the command I actually want
> returned. When I run 'describe-key-briefly' and type <backspace>, I get
> 
> DEL (translated from <backspace>) runs the command lispy-delete-backward
> 
> but I don't know how to look up that translation from Elisp. I looked at
> the code for 'help.el' and found the above description comes from
> 'read-key-sequence' returning 'C-?' and 'this-single-command-raw-keys'
> returning '[backspace]' but 'read-key-sequence' is defined in C and I
> don't know how trigger it's translation logic programmatically from
> Elisp.

Perhaps Stefan (CC'ed) could help you.

Btw, this kind of questions should be posted to
help-gnu-emacs <at> gnu.org, not here.




This bug report was last modified 1 year and 228 days ago.

Previous Next


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