The doc of
(execute-kbd-macro MACRO &optional COUNT LOOPFUNC)
If MACRO is a symbol, its function definition is used.
I tried M-:
That bailed out with the following error message:
Keyboard macros must be strings or vectors
That happens with
GNU Emacs 26.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2019-04-12.
Is that an Emacs bug, a documentation bug, or do I misunderstand something?
Might it be that the function definition of the symbol must be a keyboard macro? At least the following code works:
(fset 'a (kbd "myfun")) (execute-kbd-macro 'a)
Background: I wanted to use
apply-macro-to-region-lines on a command in an answer about applying
comment-indent on a region.