]> code.delx.au - gnu-emacs/blobdiff - doc/lispref/keymaps.texi
Merge from origin/emacs-25
[gnu-emacs] / doc / lispref / keymaps.texi
index f5d3811faedb4dab7c528a437d8366d84a26ddfa..35d9d0c96549b224d1593b81820f465ab547389c 100644 (file)
@@ -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