diff lispref/keymaps.texi @ 89945:59dcbfe97385

Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-17 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-417 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-419 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-420 Tweak permissions * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-421 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-430 Update from CVS
author Miles Bader <miles@gnu.org>
date Tue, 29 Jun 2004 16:46:06 +0000
parents 4c90ffeb71c5 b4cff9b59252
children d8411455de48
line wrap: on
line diff
--- a/lispref/keymaps.texi	Tue Jun 29 15:25:11 2004 +0000
+++ b/lispref/keymaps.texi	Tue Jun 29 16:46:06 2004 +0000
@@ -95,6 +95,27 @@
 keymaps shadow both local and global keymaps.  @xref{Active Keymaps},
 for details.
 
+  The Emacs Lisp representation for a key sequence is a string or vector.
+You can enter key sequence constants using the ordinary string or vector
+representation; it is also convenient to use @code{kbd}:
+
+@defmac kbd keyseq-text
+This macro converts the text @var{keyseq-text} (a string constant)
+into a key sequence (a string or vector constant).  The contents
+of @var{keyseq-text} should describe the key sequence using the syntax
+used in this manual:
+
+@example
+(kbd "C-x") @result{} "\C-x"
+(kbd "C-x C-f") @result{} "\C-x\C-f"
+(kbd "C-c C-c") @result{} "\C-c\C-c"
+(kbd "C-x 4 C-f") @result{} "\C-x4\C-f"
+(kbd "X") @result{} "X"
+(kbd "RET") @result{} "\^M"
+(kbd "C-c 3") @result{} "\C-c3"
+@end example
+@end defmac
+
 @node Format of Keymaps
 @section Format of Keymaps
 @cindex format of keymaps
@@ -880,6 +901,10 @@
     @result{} find-file
 @end group
 @group
+(lookup-key (current-global-map) (kbd "C-x C-f"))
+    @result{} find-file
+@end group
+@group
 (lookup-key (current-global-map) "\C-x\C-f12345")
     @result{} 2
 @end group
@@ -1126,7 +1151,7 @@
 
 @group
 ;; @r{Build sparse submap for @kbd{C-x} and bind @kbd{f} in that.}
-(define-key map "\C-xf" 'forward-word)
+(define-key map (kbd "C-x f") 'forward-word)
     @result{} forward-word
 @end group
 @group
@@ -1139,14 +1164,14 @@
 
 @group
 ;; @r{Bind @kbd{C-p} to the @code{ctl-x-map}.}
-(define-key map "\C-p" ctl-x-map)
+(define-key map (kbd "C-p") ctl-x-map)
 ;; @code{ctl-x-map}
 @result{} [nil @dots{} find-file @dots{} backward-kill-sentence]
 @end group
 
 @group
 ;; @r{Bind @kbd{C-f} to @code{foo} in the @code{ctl-x-map}.}
-(define-key map "\C-p\C-f" 'foo)
+(define-key map (kbd "C-p C-f") 'foo)
 @result{} 'foo
 @end group
 @group
@@ -1333,7 +1358,7 @@
 (@pxref{Init File}) for simple customization.  For example,
 
 @smallexample
-(global-set-key "\C-x\C-\\" 'next-line)
+(global-set-key (kbd "C-x C-\\") 'next-line)
 @end smallexample
 
 @noindent