comparison lispref/keymaps.texi @ 90796:4ef881a120fe

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 675-697) - Update from CVS - Merge from gnus--rel--5.10 - Release ERC 5.2. * gnus--rel--5.10 (patch 211-215) - Update from CVS - Merge from emacs--devo--0 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-189
author Miles Bader <miles@gnu.org>
date Wed, 11 Apr 2007 00:17:47 +0000
parents 95d0cdf160ea b47dd202aa79
children e6fdae9180d4
comparison
equal deleted inserted replaced
90795:b9182b6a90c9 90796:4ef881a120fe
51 The Emacs Lisp representation for a key sequence is a string or 51 The Emacs Lisp representation for a key sequence is a string or
52 vector. Unless otherwise stated, any Emacs Lisp function that accepts 52 vector. Unless otherwise stated, any Emacs Lisp function that accepts
53 a key sequence as an argument can handle both representations. 53 a key sequence as an argument can handle both representations.
54 54
55 In the string representation, alphanumeric characters ordinarily 55 In the string representation, alphanumeric characters ordinarily
56 stand for themselves; for example, @code{"a"} represents @kbd{a} and 56 stand for themselves; for example, @code{"a"} represents @kbd{a}
57 and @code{"2"} represents @kbd{2}. Control character events are 57 and @code{"2"} represents @kbd{2}. Control character events are
58 prefixed by the substring @code{"\C-"}, and meta characters by 58 prefixed by the substring @code{"\C-"}, and meta characters by
59 @code{"\M-"}; for example, @code{"\C-x"} represents the key @kbd{C-x}. 59 @code{"\M-"}; for example, @code{"\C-x"} represents the key @kbd{C-x}.
60 In addition, the @key{TAB}, @key{RET}, @key{ESC}, and @key{DEL} events 60 In addition, the @key{TAB}, @key{RET}, @key{ESC}, and @key{DEL} events
61 are represented by @code{"\t"}, @code{"\r"}, @code{"\e"}, and 61 are represented by @code{"\t"}, @code{"\r"}, @code{"\e"}, and
695 @end example 695 @end example
696 @end defun 696 @end defun
697 697
698 @node Searching Keymaps 698 @node Searching Keymaps
699 @section Searching the Active Keymaps 699 @section Searching the Active Keymaps
700 @cindex searching active keymaps for keys
700 701
701 After translation of event subsequences (@pxref{Translation 702 After translation of event subsequences (@pxref{Translation
702 Keymaps}) Emacs looks for them in the active keymaps. Here is a 703 Keymaps}) Emacs looks for them in the active keymaps. Here is a
703 pseudo-Lisp description of the order and conditions for searching 704 pseudo-Lisp description of the order and conditions for searching
704 them: 705 them:
1275 new binding is added at the beginning of @var{keymap}. The order of 1276 new binding is added at the beginning of @var{keymap}. The order of
1276 bindings in a keymap makes no difference for keyboard input, but it 1277 bindings in a keymap makes no difference for keyboard input, but it
1277 does matter for menu keymaps (@pxref{Menu Keymaps}). 1278 does matter for menu keymaps (@pxref{Menu Keymaps}).
1278 @end defun 1279 @end defun
1279 1280
1280 Here is an example that creates a sparse keymap and makes a number of 1281 This example creates a sparse keymap and makes a number of
1281 bindings in it: 1282 bindings in it:
1282 1283
1283 @smallexample 1284 @smallexample
1284 @group 1285 @group
1285 (setq map (make-sparse-keymap)) 1286 (setq map (make-sparse-keymap))
1486 @code{my-other-kill-line}. If an ordinary key binding specifies 1487 @code{my-other-kill-line}. If an ordinary key binding specifies
1487 @code{kill-line}, this keymap will remap it to @code{my-kill-line}; 1488 @code{kill-line}, this keymap will remap it to @code{my-kill-line};
1488 if an ordinary binding specifies @code{my-kill-line}, this keymap will 1489 if an ordinary binding specifies @code{my-kill-line}, this keymap will
1489 remap it to @code{my-other-kill-line}. 1490 remap it to @code{my-other-kill-line}.
1490 1491
1491 @defun command-remapping command &optional position 1492 @defun command-remapping command &optional position keymaps
1492 This function returns the remapping for @var{command} (a symbol), 1493 This function returns the remapping for @var{command} (a symbol),
1493 given the current active keymaps. If @var{command} is not remapped 1494 given the current active keymaps. If @var{command} is not remapped
1494 (which is the usual situation), or not a symbol, the function returns 1495 (which is the usual situation), or not a symbol, the function returns
1495 @code{nil}. @code{position} can optionally specify a buffer position 1496 @code{nil}. @code{position} can optionally specify a buffer position
1496 or an event position to determine the keymaps to use, as in 1497 or an event position to determine the keymaps to use, as in
1497 @code{key-binding}. 1498 @code{key-binding}.
1499
1500 If the optional argument @code{keymaps} is non-@code{nil}, it
1501 specifies a list of keymaps to search in. This argument is ignored if
1502 @code{position} is non-@code{nil}.
1498 @end defun 1503 @end defun
1499 1504
1500 @node Translation Keymaps 1505 @node Translation Keymaps
1501 @section Keymaps for Translating Sequences of Events 1506 @section Keymaps for Translating Sequences of Events
1507 @cindex keymaps for translating events
1502 1508
1503 This section describes keymaps that are used during reading a key 1509 This section describes keymaps that are used during reading a key
1504 sequence, to translate certain event sequences into others. 1510 sequence, to translate certain event sequences into others.
1505 @code{read-key-sequence} checks every subsequence of the key sequence 1511 @code{read-key-sequence} checks every subsequence of the key sequence
1506 being read, as it is read, against @code{function-key-map} and then 1512 being read, as it is read, against @code{function-key-map} and then