Each keymap is a list whose car is the symbol
remaining elements of the list define the key bindings of the keymap.
A symbol whose function definition is a keymap is also a keymap. Use
keymapp (see below) to test whether an object is a
Several kinds of elements may appear in a keymap, after the symbol
keymap that begins it:
(type item-name help-string
When the binding is
nil, it doesn't constitute a definition
but it does take precedence over a default binding or a binding in the
parent keymap. On the other hand, a binding of
not override lower-precedence keymaps; thus, if the local map
gives a binding of
nil, Emacs uses the binding from the
Keymaps do not directly record bindings for the meta characters.
Instead, meta characters are regarded for purposes of key lookup as
sequences of two characters, the first of which is <ESC> (or
whatever is currently the value of
meta-prefix-char). Thus, the
key M-a is internally represented as <ESC> a, and its
global binding is found at the slot for a in
(see Prefix Keys).
This conversion applies only to characters, not to function keys or other input events; thus, M-<end> has nothing to do with <ESC> <end>.
Here as an example is the local keymap for Lisp mode, a sparse keymap. It defines bindings for <DEL>, C-c C-z, C-M-q, and C-M-x (the actual value also contains a menu binding, which is omitted here for the sake of brevity).
lisp-mode-map ⇒ (keymap (3 keymap ;; C-c C-z (26 . run-lisp)) (27 keymap ;; C-M-x, treated as <ESC> C-x (24 . lisp-send-defun)) ;; This part is inherited from
lisp-mode-shared-map. keymap ;; <DEL> (127 . backward-delete-char-untabify) (27 keymap ;; C-M-q, treated as <ESC> C-q (17 . indent-sexp)))
This function returns
tif object is a keymap,
nilotherwise. More precisely, this function tests for a list whose car is
keymap, or for a symbol whose function definition satisfies
keymapp.(keymapp '(keymap)) ⇒ t (fset 'foo '(keymap)) (keymapp 'foo) ⇒ t (keymapp (current-global-map)) ⇒ t