aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2011-05-29 15:00:00 -0400
committerChong Yidong2011-05-29 15:00:00 -0400
commit58539c631a46db82b7f254bfcd00d7f02d96d366 (patch)
treee218dc55c7e238fd7ee97f119fecd84cbea40a26
parentd66c4c7ce6d8a4ee19a7d4faae59fc6dc25fcc1a (diff)
downloademacs-58539c631a46db82b7f254bfcd00d7f02d96d366.tar.gz
emacs-58539c631a46db82b7f254bfcd00d7f02d96d366.zip
Clarify Remapping Commands node in Lisp manual (Bug#8350).
* keymaps.texi (Remapping Commands): Emphasize that the keymap needs to be active.
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/keymaps.texi51
2 files changed, 30 insertions, 26 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 87ef485518e..ce3521b37d5 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,8 @@
12011-05-29 Chong Yidong <cyd@stupidchicken.com>
2
3 * keymaps.texi (Remapping Commands): Emphasize that the keymap
4 needs to be active (Bug#8350).
5
12011-05-28 Chong Yidong <cyd@stupidchicken.com> 62011-05-28 Chong Yidong <cyd@stupidchicken.com>
2 7
3 * minibuf.texi (Reading File Names): Clarify (Bug#8480). 8 * minibuf.texi (Reading File Names): Clarify (Bug#8480).
diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi
index 2ebce284fd3..bf3c18ca682 100644
--- a/doc/lispref/keymaps.texi
+++ b/doc/lispref/keymaps.texi
@@ -1468,33 +1468,33 @@ Dired mode is set up:
1468@section Remapping Commands 1468@section Remapping Commands
1469@cindex remapping commands 1469@cindex remapping commands
1470 1470
1471 A special kind of key binding, using a special ``key sequence'' 1471 A special kind of key binding can be used to @dfn{remap} one command
1472which includes a command name, has the effect of @dfn{remapping} that 1472to another, without having to refer to the key sequence(s) bound to
1473command into another. Here's how it works. You make a key binding 1473the original command. To use this feature, make a key binding for a
1474for a key sequence that starts with the dummy event @code{remap}, 1474key sequence that starts with the dummy event @code{remap}, followed
1475followed by the command name you want to remap. Specify the remapped 1475by the command name you want to remap; for the binding, specify the
1476definition as the definition in this binding. The remapped definition 1476new definition (usually a command name, but possibly any other valid
1477is usually a command name, but it can be any valid definition for 1477definition for a key binding).
1478a key binding. 1478
1479 1479 For example, suppose My mode provides a special command
1480 Here's an example. Suppose that My mode uses special commands 1480@code{my-kill-line}, which should be invoked instead of
1481@code{my-kill-line} and @code{my-kill-word}, which should be invoked 1481@code{kill-line}. To establish this, its mode keymap should contain
1482instead of @code{kill-line} and @code{kill-word}. It can establish 1482the following remapping:
1483this by making these two command-remapping bindings in its keymap:
1484 1483
1485@smallexample 1484@smallexample
1486(define-key my-mode-map [remap kill-line] 'my-kill-line) 1485(define-key my-mode-map [remap kill-line] 'my-kill-line)
1487(define-key my-mode-map [remap kill-word] 'my-kill-word)
1488@end smallexample 1486@end smallexample
1489 1487
1490Whenever @code{my-mode-map} is an active keymap, if the user types 1488@noindent
1491@kbd{C-k}, Emacs will find the standard global binding of 1489Then, whenever @code{my-mode-map} is active, if the user types
1492@code{kill-line} (assuming nobody has changed it). But 1490@kbd{C-k} (the default global key sequence for @code{kill-line}) Emacs
1493@code{my-mode-map} remaps @code{kill-line} to @code{my-kill-line}, 1491will instead run @code{my-kill-line}.
1494so instead of running @code{kill-line}, Emacs runs
1495@code{my-kill-line}.
1496 1492
1497Remapping only works through a single level. In other words, 1493 Note that remapping only takes place through active keymaps; for
1494example, putting a remapping in a prefix keymap like @code{ctl-x-map}
1495typically has no effect, as such keymaps are not themselves active.
1496In addition, remapping only works through a single level; in the
1497following example,
1498 1498
1499@smallexample 1499@smallexample
1500(define-key my-mode-map [remap kill-line] 'my-kill-line) 1500(define-key my-mode-map [remap kill-line] 'my-kill-line)
@@ -1502,11 +1502,10 @@ Remapping only works through a single level. In other words,
1502@end smallexample 1502@end smallexample
1503 1503
1504@noindent 1504@noindent
1505does not have the effect of remapping @code{kill-line} into 1505@code{kill-line} is @emph{not} remapped to @code{my-other-kill-line}.
1506@code{my-other-kill-line}. If an ordinary key binding specifies 1506Instead, if an ordinary key binding specifies @code{kill-line}, it is
1507@code{kill-line}, this keymap will remap it to @code{my-kill-line}; 1507remapped to @code{my-kill-line}; if an ordinary binding specifies
1508if an ordinary binding specifies @code{my-kill-line}, this keymap will 1508@code{my-kill-line}, it is remapped to @code{my-other-kill-line}.
1509remap it to @code{my-other-kill-line}.
1510 1509
1511To undo the remapping of a command, remap it to @code{nil}; e.g. 1510To undo the remapping of a command, remap it to @code{nil}; e.g.
1512 1511