help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get key-binding for a command and print key binding in kbd syntax


From: Robert Pluim
Subject: Re: Get key-binding for a command and print key binding in kbd syntax
Date: Thu, 09 Feb 2023 13:20:44 +0100

>>>>> On Thu, 09 Feb 2023 12:58:37 +0100, Tassilo Horn <tsdh@gnu.org> said:

    Tassilo> No, no.  I've meant that with substitute-command-keys I have the 
correct
    Tassilo> key-descriptions in the buffer with help-key-binding face.  
However, I
    Tassilo> would also like to have them clickable so I think I need to 
"parse" the
    Tassilo> buffer and add keymap properties to the text having the 
help-key-binding
    Tassilo> face.

    Tassilo> So for example, there is the text "[j]ump to some maildir" where 
the j
    Tassilo> is a key-description (recognizable by its help-key-binding face), 
I need
    Tassilo> to translate back the j to the command mu4e-search-maildir in 
order to
    Tassilo> add a keymap where RET and mouse-2 are bound to that command.

Iʼm not sure Iʼm getting it.

- You insert (substitute-command-keys "\\[mu4e-search-maildir]")
- At that point you can add a 'keymap property to the text youʼve just
  inserted, binding RET and mouse-2 to #'mu4e-search-maildir

Why do you need to lookup "j" in the local map at all?

(as an aside, clickable stuff is probably better done with buttons
than by inventing your own thing).

Robert
-- 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]