Subject: bug#6848: insert-kbd-macro

From: Noam Postavsky <[email-masked]>
Date: Tue, 31 May 2016 20:00:23 -0400

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. The fix for #5481 fixed the lambda case but
broke the symbol case. Should be easy enough to handle both:

diff --git i/lisp/macros.el w/lisp/macros.el
index f7a4732..c456dcb 100644
--- i/lisp/macros.el
+++ w/lisp/macros.el
@@ -140,8 +140,9 @@ insert-kbd-macro
     (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))