[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 12:44:16 +0100 |
>>>>> On Thu, 09 Feb 2023 12:09:14 +0100, Tassilo Horn <tsdh@gnu.org> said:
Tassilo> Oh, not quite. Right now, there's for example a "[C]ompose a new
mail"
Tassilo> text where the C also has a keymap property which would invoke the
Tassilo> respective command on mouse-2 and RET. `substitute-command-keys'
Tassilo> doesn't allow doing that out of the box. So one would need to
iterate
Tassilo> over occurrences of the help-key-binding face afterwards,
translate back
Tassilo> to the command and add a keymap property.
Tassilo> How do I lookup a command for the printed key description?
Tassilo> (keymap-lookup nil "C-c C-c")
Tassilo> ;=> message-send-and-exit
Tassilo> works but is too new to be used for packages supporting
Tassilo> older emacsen.
I think `keymap-lookup' will be in `compat' when emacs-29 comes out
Tassilo> Is
Tassilo> (lookup-key (current-local-map) (kbd "C-c C-c"))
Tassilo> the right incarnation?
For a 'keymap property? Probably
(get-char-property (point) 'keymap)
is needed to get the right map. `current-local-map' is for the buffer.
Robert
--
- Get key-binding for a command and print key binding in kbd syntax, Tassilo Horn, 2023/02/09
- Re: Get key-binding for a command and print key binding in kbd syntax, Robert Pluim, 2023/02/09
- Re: Get key-binding for a command and print key binding in kbd syntax, Tassilo Horn, 2023/02/09
- Re: Get key-binding for a command and print key binding in kbd syntax, Tassilo Horn, 2023/02/09
- Re: Get key-binding for a command and print key binding in kbd syntax,
Robert Pluim <=
- Re: Get key-binding for a command and print key binding in kbd syntax, Tassilo Horn, 2023/02/09
- Re: Get key-binding for a command and print key binding in kbd syntax, Robert Pluim, 2023/02/09
- Re: Get key-binding for a command and print key binding in kbd syntax, Tassilo Horn, 2023/02/09
- Re: Get key-binding for a command and print key binding in kbd syntax, Robert Pluim, 2023/02/09
- Re: Get key-binding for a command and print key binding in kbd syntax, Tassilo Horn, 2023/02/09