emacsmacros

How can I generate a keyboard macro in my Emacs init file?


I am defining a particular keyboard macro quite often, so I thought that it might be handy if it was automatically available every time I load Emacs.

How can I do this?


Solution

  • How about the save keyboard macros section of the manual?

    C-x C-k n
        Give a command name (for the duration of the Emacs session) to the most recently defined keyboard macro (kmacro-name-last-macro).
    C-x C-k b
        Bind the most recently defined keyboard macro to a key sequence (for the duration of the session) (kmacro-bind-to-key).
    M-x insert-kbd-macro
        Insert in the buffer a keyboard macro's definition, as Lisp code.