diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2016-06-15 11:36:51 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2016-06-15 11:36:51 -0400 |
commit | 4a2092efd2ac76fce04a2587b360ed2ca1eac4d7 (patch) | |
tree | bf5f38017fa292ee4bf17af607d5163831b26d64 /doc | |
parent | 090060a72c7245796bffeb14daf9da1b49f339f0 (diff) |
Advertize set-keymap-parent as replacement for copy-keymap
* doc/lispref/keymaps.texi (Creating Keymaps):
* src/keymap.c (Fcopy_keymap): Advertize set-keymap-parent as replacement.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/lispref/keymaps.texi | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi index 61ac80c589..9abbd898d9 100644 --- a/doc/lispref/keymaps.texi +++ b/doc/lispref/keymaps.texi @@ -341,7 +341,21 @@ lots of bindings; for just a few, the sparse keymap is better. @end defun @defun copy-keymap keymap -This function returns a copy of @var{keymap}. Any keymaps that +This function returns a copy of @var{keymap}. 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: + +@example +@group +(let ((map (make-sparse-keymap))) + (set-keymap-parent map <theirmap>) + (define-key map ...) + ...) +@end group +@end example + +When performing @code{copy-keymap}, any keymaps that appear directly as bindings in @var{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 |