Buy the book!
|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
A keymap can inherit the bindings of another keymap, which we call the parent keymap. Such a keymap looks like this:
(keymap bindings... . parent-keymap)
The effect is that this keymap inherits all the bindings of parent-keymap, whatever they may be at the time a key is looked up, but can add to them or override them with bindings.
If you change the bindings in parent-keymap using
or other key-binding functions, these changes are visible in the
inheriting keymap unless shadowed by bindings. The converse is
not true: if you use
define-key to change the inheriting keymap,
that affects bindings, but has no effect on parent-keymap.
The proper way to construct a keymap with a parent is to use
set-keymap-parent; if you have code that directly constructs a
keymap with a parent, please convert the program to use
nil, this function gives keymap no parent at all.
If keymap has submaps (bindings for prefix keys), they too receive new parent keymaps that reflect what parent specifies for those prefix keys.
Here is an example showing how to make a keymap that inherits
(let ((map (make-sparse-keymap))) (set-keymap-parent map text-mode-map) map)
|webmaster donations bookstore||delorie software privacy|
|Copyright © 2003 by The Free Software Foundation||Updated Jun 2003|