diff options
author | Richard M. Stallman <rms@gnu.org> | 2001-09-06 19:37:04 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 2001-09-06 19:37:04 +0000 |
commit | ce3bd809e3fd16e535477e938a6f77e480cbc60d (patch) | |
tree | aea25a7d3a8b40b9adb9c2517a82cafdd0c6af01 /man/custom.texi | |
parent | f76e03683e1e34fea4aadcc890b762541f50efd8 (diff) | |
download | emacs-ce3bd809e3fd16e535477e938a6f77e480cbc60d.tar.gz |
Show how to put more special ASCII characters
in strings and vectors.
Diffstat (limited to 'man/custom.texi')
-rw-r--r-- | man/custom.texi | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/man/custom.texi b/man/custom.texi index ae9b2be8901..2811c4caa3c 100644 --- a/man/custom.texi +++ b/man/custom.texi @@ -1621,6 +1621,15 @@ string, you can use the Emacs Lisp escape sequences, @samp{\t}, (global-set-key "\C-x\t" 'indent-rigidly) @end example + These examples show how to write some other special ASCII characters +in strings for key bindings: + +@example +(global-set-key "\r" 'newline) ;; @key{RET} +(global-set-key "\d" 'delete-backward-char) ;; @key{DEL} +(global-set-key "\C-x\e\e" 'repeat-complex-command) ;; @key{ESC} +@end example + When the key sequence includes function keys or mouse button events, or non-ASCII characters such as @code{C-=} or @code{H-a}, you must use the more general method of rebinding, which uses a vector to specify the @@ -1647,15 +1656,24 @@ keyboard-modified mouse button): (global-set-key [C-mouse-1] 'make-symbolic-link) @end example - You can use a vector for the simple cases too. Here's how to rewrite -the first three examples, above, using vectors: + You can use a vector for the simple cases too. Here's how to +rewrite the first three examples above, using vectors to bind +@kbd{C-z}, @kbd{C-x l}, and @kbd{C-x @key{TAB}}: @example (global-set-key [?\C-z] 'shell) (global-set-key [?\C-x ?l] 'make-symbolic-link) (global-set-key [?\C-x ?\t] 'indent-rigidly) +(global-set-key [?\r] 'newline) +(global-set-key [?\d] 'delete-backward-char) +(global-set-key [?\C-x ?\e ?\e] 'repeat-complex-command) @end example +@noindent +As you see, you represent a multi-character key sequence with a vector +by listing each of the characters within the square brackets that +delimit the vector. + @node Function Keys @subsection Rebinding Function Keys |