GNU Info

Info Node: (elisp)Creating Keymaps

(elisp)Creating Keymaps


Next: Inheritance and Keymaps Prev: Format of Keymaps Up: Keymaps
Enter node , (file) or (file)node

Creating Keymaps
================

   Here we describe the functions for creating keymaps.

 - Function: make-keymap &optional prompt
     This function creates and returns a new full keymap.  That keymap
     contains a char-table (Note: Char-Tables) with 384 slots: the
     first 128 slots are for defining all the ASCII characters, the
     next 128 slots are for 8-bit European characters, and each one of
     the final 128 slots is for one character set of non-ASCII
     characters supported by Emacs.  The new keymap initially binds all
     these 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 should be provided for menu keymaps
     (Note: Defining Menus).

 - Function: make-sparse-keymap &optional prompt
     This function creates and returns a new sparse keymap with no
     entries.  The new keymap does not contain a char-table, unlike
     `make-keymap', and 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


automatically generated by info2www version 1.2.2.9