Go to the first, previous, next, last section, table of contents.


Creating Keymaps

Here we describe the functions for creating keymaps.

Function: make-keymap &optional prompt
This function creates and returns a new full keymap (i.e., one containing a vector of length 128 for defining all the ASCII characters). The new keymap initially binds all ASCII characters to nil, and does not bind any other kind of event.

(make-keymap)
    => (keymap [nil nil nil ... nil nil])

If you specify prompt, that becomes the overall prompt string for the keymap. The prompt string is useful for menu keymaps (see section Menu Keymaps).

Function: make-sparse-keymap &optional prompt
This function creates and returns a new sparse keymap with no entries. The new keymap does not bind any events. The argument prompt specifies a prompt string, as in make-keymap.

(make-sparse-keymap)
    => (keymap)

Function: copy-keymap keymap
This function returns a copy of keymap. Any keymaps that appear directly as bindings in keymap are also copied recursively, and so on to any number of levels. However, recursive copying does not take place when the definition of a character is a symbol whose function definition is a keymap; the same symbol appears in the new copy.

(setq map (copy-keymap (current-local-map)))
=> (keymap
     ;; (This implements meta characters.)
     (27 keymap         
         (83 . center-paragraph)
         (115 . center-line))
     (9 . tab-to-tab-stop))

(eq map (current-local-map))
    => nil
(equal map (current-local-map))
    => t


Go to the first, previous, next, last section, table of contents.