Find macro binding for symbol-bound macros too (Bug#6848)

There are 2 ways to bind a macro: with global-set-key or
kmacro-bind-to-key.  The former binds a key to a symbol, while the
latter binds to a lambda.  In 2010-03-03 "Fix keyboard macro key
lookup (Bug#5481)", `insert-kbd-macro' was fixed to detect the lambda
case, but broke the symbol case.

* lisp/macros.el (insert-kbd-macro): Also check for bindings of
MACRONAME.
This commit is contained in:
Noam Postavsky 2017-02-21 21:31:24 -05:00
parent 3f1cd957ff
commit 907bad07f2

View file

@ -140,8 +140,9 @@ use this command, and then save the file."
(prin1 definition (current-buffer))))
(insert ")\n")
(if keys
(let ((keys (where-is-internal (symbol-function macroname)
'(keymap))))
(let ((keys (or (where-is-internal (symbol-function macroname)
'(keymap))
(where-is-internal macroname '(keymap)))))
(while keys
(insert "(global-set-key ")
(prin1 (car keys) (current-buffer))