

This function creates either a string or a vector. There's just one last place to look: end_kbd_macro sets last-kbd-macro to the newly-defined macro using a function make_event_array.
#Emacs macros code#
However, this particular code is only used when appending new keystrokes to the end of the most recently-recorded macro, and it converts the string back into a vector. The comment says "Check the type of last-kbd-macro in case Lisp code changed it.", so perhaps there was some lisp code running around which replaced the value of last-kbd-macro with a string instead of a vector. However, in 1999 in commit f8a4db7d code was added to start-kdb-macro that checked to see if the current value of last-kbd-macro was a string. last-kbd-macro has been a vector of keys since at least 1995. Prior to this change name-last-kbd-macro simply fset your choosen name with the value of last-kbd-macro. (This is the lambda form that insert-kbd-macro checks for).

kmacro-name-last-macro has since 2004 always created a definition which is a lambda containing a vector, like this: (lambda The last change to the name-last-kbd-macro was commit 4f779ff8 in 2017, when it was removed and made an alias of kmacro-name-last-macro. If the macro definition is a lambda, then the body of the macro will be printed as a call to kmacro-lambda-form which builds the same lambda. If it's a vector, then it outputs the form you now get. If the macro definition is a string, then it outputs the form you are used to seeing. Insert-kbd-macro can insert a number of different forms, but ultimately the definition of the macro can be either a string, a vector, or a lambda.
