I have recently defined a keyboard macro using C-x ( and C-x). I then gave the keyboard macro a name using M-x name-last-kbd-macro RET defined-kbd-macro. And saved it to a file using M-x insert-kbd-macro. When I used C-h f RET defined-kbd-macro, under documentation it simply stated that it was a keyboard macro. Is there a way to include a doc string in fset command?

1 Answer 1


As the Elisp manual describes, you can also put the documentation string into the function-documentation property of the symbol of the macro.


(fset 'defined-kbd-macro
   (kmacro-lambda-form [?I ?  ?a ?m ?  ?a ?  ?m ?a ?c ?r ?o ?.] 0 "%d"))

(put 'defined-kbd-macro 'function-documentation "My own documentation.")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.