]> git.eshelyaron.com Git - emacs.git/commitdiff
Explain how to bind keys to non-ASCII sequences
authorRobert Pluim <rpluim@gmail.com>
Mon, 14 Nov 2022 16:12:49 +0000 (17:12 +0100)
committerRobert Pluim <rpluim@gmail.com>
Mon, 14 Nov 2022 16:16:40 +0000 (17:16 +0100)
* doc/emacs/custom.texi (Init Rebinding): Explain how to use `kbd'
when binding keys to non-ASCII sequences.

doc/emacs/custom.texi

index 2bc1d3820d11002e4775a8f2355d559b270e1599..65970ce412ca768950949de10672e927e0b5f9f2 100644 (file)
@@ -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