| [ < ] | [ > ] | [ << ] | [Plus haut] | [ >> ] | [Top] | [Table des matières] | [Index] | [ ? ] |
A special kind of key binding, using a special “key sequence” which
includes a command name, has the effect of remapping that command into
another. Here's how it works. You make a key binding for a key sequence
that starts with the dummy event remap, followed by the command name
you want to remap. Specify the remapped definition as the definition in
this binding. The remapped definition is usually a command name, but it can
be any valid definition for a key binding.
Here's an example. Suppose that My mode uses special commands
my-kill-line and my-kill-word, which should be invoked instead
of kill-line and kill-word. It can establish this by making
these two command-remapping bindings in its keymap:
(define-key my-mode-map [remap kill-line] 'my-kill-line) (define-key my-mode-map [remap kill-word] 'my-kill-word) |
Whenever my-mode-map is an active keymap, if the user types
C-k, Emacs will find the standard global binding of kill-line
(assuming nobody has changed it). But my-mode-map remaps
kill-line to my-kill-line, so instead of running
kill-line, Emacs runs my-kill-line.
Remapping only works through a single level. In other words,
(define-key my-mode-map [remap kill-line] 'my-kill-line) (define-key my-mode-map [remap my-kill-line] 'my-other-kill-line) |
does not have the effect of remapping kill-line into
my-other-kill-line. If an ordinary key binding specifies
kill-line, this keymap will remap it to my-kill-line; if an
ordinary binding specifies my-kill-line, this keymap will remap it to
my-other-kill-line.
This function returns the remapping for command (a symbol), given the
current active keymaps. If command is not remapped (which is the
usual situation), or not a symbol, the function returns nil.
position can optionally specify a buffer position or an event
position to determine the keymaps to use, as in key-binding.
If the optional argument keymaps is non-nil, it specifies a
list of keymaps to search in. This argument is ignored if position
is non-nil.
| [ < ] | [ > ] | [ << ] | [Plus haut] | [ >> ] | [Top] | [Table des matières] | [Index] | [ ? ] |
Ce document a été généré par Eric Reinbold le 13 Octobre 2007 en utilisant texi2html 1.78.