comparison lispref/keymaps.texi @ 49182:943603fc2ef2

(Changing Key Bindings) <define-key>: Mention how to define a default binding.
author Richard M. Stallman <rms@gnu.org>
date Mon, 13 Jan 2003 07:59:04 +0000
parents 6123edb0c45e
children fea7066c9e82
comparison
equal deleted inserted replaced
49181:94d20f0ab516 49182:943603fc2ef2
1061 in another keymap reached from @var{keymap}.) The argument 1061 in another keymap reached from @var{keymap}.) The argument
1062 @var{binding} can be any Lisp object, but only certain types are 1062 @var{binding} can be any Lisp object, but only certain types are
1063 meaningful. (For a list of meaningful types, see @ref{Key Lookup}.) 1063 meaningful. (For a list of meaningful types, see @ref{Key Lookup}.)
1064 The value returned by @code{define-key} is @var{binding}. 1064 The value returned by @code{define-key} is @var{binding}.
1065 1065
1066 If @var{key} is @code{[t]}, this sets the default binding in
1067 @var{keymap}. When an event has no binding of its own, the Emacs
1068 command loop uses the keymap's default binding, if there is one.
1069
1066 @cindex invalid prefix key error 1070 @cindex invalid prefix key error
1067 @cindex key sequence error 1071 @cindex key sequence error
1068 Every prefix of @var{key} must be a prefix key (i.e., bound to a keymap) 1072 Every prefix of @var{key} must be a prefix key (i.e., bound to a keymap)
1069 or undefined; otherwise an error is signaled. If some prefix of 1073 or undefined; otherwise an error is signaled. If some prefix of
1070 @var{key} is undefined, then @code{define-key} defines it as a prefix 1074 @var{key} is undefined, then @code{define-key} defines it as a prefix
1071 key so that the rest of @var{key} can be defined as specified. 1075 key so that the rest of @var{key} can be defined as specified.
1072 1076
1073 If there was previously no binding for @var{key} in @var{keymap}, the 1077 If there was previously no binding for @var{key} in @var{keymap}, the
1074 new binding is added at the beginning of @var{keymap}. The order of 1078 new binding is added at the beginning of @var{keymap}. The order of
1075 bindings in a keymap makes no difference in most cases, but it does 1079 bindings in a keymap makes no difference for keyboard input, but it
1076 matter for menu keymaps (@pxref{Menu Keymaps}). 1080 does matter for menu keymaps (@pxref{Menu Keymaps}).
1077 @end defun 1081 @end defun
1078 1082
1079 Here is an example that creates a sparse keymap and makes a number of 1083 Here is an example that creates a sparse keymap and makes a number of
1080 bindings in it: 1084 bindings in it:
1081 1085