Having written a function (say, my-func
), I wanted to map it in ledger-mode-map
to the keypress that I will call "Control dollar," that is, the dollar sign $, typed while the Ctrl key is held down.
The expression:
(define-key ledger-mode-map (kbd "C-$") 'my-func)
when executed does not indicate a failure, but a subsequent C-h my-func
indicates no key binding.
Executing C-h k C-$
produces the output "C-$ is undefined".
I need a way to express "Control dollar" so that Emacs can recognize it as a keypress, if that is even possible. Here are a few of the alternatives I have tried to (kbd "C-$")
:
Expression | Result when evaluated |
---|---|
[?\C-4] | 67108916 |
[?\C-\$] | 67108900 |
(kbd "C-\$") | 67108900 |
[C-S-4] | [C-S-4] |
(kbd "[67108900]") | "[67108916]" |
[$] | [$] |
[\$] | [$] |
(kbd "C-[$]") | C- must prefix a single character, not [$] |
(kbd "C-$") | 67108900 |
[(control $)] | [(control $)] |
[(control \$)] | [(control $)] |
@amitp: It does work if I use global-map
instead of ledger-mode-map
. It does not work if I use, say, C-!
instead of C-$
with ledger-mode-map
.
C-$
part or the mode map part. Does it work if you useglobal-map
instead ofledger-mode-map
? Does it work if you use a different keybinding instead ofC-$
?global-map
instead ofledger-mode-map
. It does not work if I use, say,C-!
instead ofC-$
withledger-mode-map
ledger-mode-map
, which is not bundled with Emacs, can you please provide a way to reproduce the problem fromemacs -q
? E.g. how you installed ledger-mode, which version exactly. Do you have the same problem if you runemacs -q
and do whatever minimum steps are needed to enable Ledger mode?(kbd "C-$")
.kbd
accepts as input what Emacs shows you as help when you useC-h k
.