changeset 39161:10b97dddcb68

Show how to put more special ASCII characters in strings and vectors.
author Richard M. Stallman <rms@gnu.org>
date Thu, 06 Sep 2001 19:37:04 +0000
parents 851d0426c8a4
children af44a4698df4
files man/custom.texi
diffstat 1 files changed, 20 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/man/custom.texi	Thu Sep 06 12:48:24 2001 +0000
+++ b/man/custom.texi	Thu Sep 06 19:37:04 2001 +0000
@@ -1621,6 +1621,15 @@
 (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 @@
 (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