Skip to content

Commit

Permalink
Explain how to bind keys to non-ASCII sequences
Browse files Browse the repository at this point in the history
* doc/emacs/custom.texi (Init Rebinding): Explain how to use `kbd'
when binding keys to non-ASCII sequences.
  • Loading branch information
rpluim committed Nov 14, 2022
1 parent 7d592db commit 5602624
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions doc/emacs/custom.texi
Expand Up @@ -1868,6 +1868,22 @@ characters. For example, here's how to bind @kbd{C-x M-l} to

@example
(global-set-key "\C-x\M-l" 'make-symbolic-link)
@end example

Similarly, a key sequence can be bound to a Lisp string or a vector
instead of a command. A vector is only required if the intended
result contains non-@acronym{ASCII} characters, and @code{kbd} can
again be used to create that vector. For example, to bind @kbd{C-c h}
to the string @samp{hello}:

@example
(global-set-key (kbd "C-c h") "hello")
@end example

But to bind it to the string @samp{olá} instead:

@example
(global-set-key (kbd "C-c h") (kbd "olá"))
@end example

To bind a key sequence including @key{TAB}, @key{RET}, @key{ESC}, or
Expand Down

0 comments on commit 5602624

Please sign in to comment.