diff options
author | Robert Pluim <rpluim@gmail.com> | 2022-11-14 17:12:49 +0100 |
---|---|---|
committer | Robert Pluim <rpluim@gmail.com> | 2022-11-14 17:16:40 +0100 |
commit | 56026242e462e8834337f118baaa9c49e2411f7d (patch) | |
tree | 17052498ba8b55a48ae711fcbac2564811fee58f /doc/emacs/custom.texi | |
parent | 7d592db0ab606e8988ef662e6a1377348a87d188 (diff) | |
download | emacs-56026242e462e8834337f118baaa9c49e2411f7d.tar.gz emacs-56026242e462e8834337f118baaa9c49e2411f7d.tar.bz2 emacs-56026242e462e8834337f118baaa9c49e2411f7d.zip |
Explain how to bind keys to non-ASCII sequences
* doc/emacs/custom.texi (Init Rebinding): Explain how to use `kbd'
when binding keys to non-ASCII sequences.
Diffstat (limited to 'doc/emacs/custom.texi')
-rw-r--r-- | doc/emacs/custom.texi | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index 2bc1d3820d1..65970ce412c 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -1870,6 +1870,22 @@ characters. For example, here's how to bind @kbd{C-x M-l} to (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 @key{DEL}, the string should contain the Emacs Lisp escape sequence @samp{\t}, @samp{\r}, @samp{\e}, or @samp{\d} respectively. Here is |