Function: copy-keymap

copy-keymap is a function defined in keymap.c.

Signature

(copy-keymap KEYMAP)

Documentation

Return a copy of the keymap KEYMAP.

Note that this is almost never needed. If you want a keymap that's like another yet with a few changes, you should use map inheritance rather than copying. I.e. something like:

    (let ((map (make-sparse-keymap)))
      (set-keymap-parent map <theirmap>)
      (define-key map ...)
      ...)

After performing copy-keymap, the copy starts out with the same definitions of KEYMAP, but changing either the copy or KEYMAP does not affect the other. Any key definitions that are subkeymaps are recursively copied. However, a key definition which is a symbol whose definition is a keymap is not copied.

Probably introduced at or before Emacs version 17.

Source Code

// Defined in /usr/src/emacs/src/keymap.c
{
  return copy_keymap_1 (keymap, 0);
}