Saving Emacs macros

April 2010


  1. Recording a macro

  2. Naming a macro

    From the Macros section of the Emacs Wiki:

    M-x name-last-kbd-macro

  3. Binding a macro to a key

    M-x global-set-key

    (... and type key and choose macro by name.)

  4. Saving a macro for later sessions

    From the EmacsWiki Macro tricks:

    M-x insert-kbd-macro

    (... and fill in the name of the macro.) Then write the output to your ~/.emacsrc, together with a key binding, like this:

    (fset '<snip>
    (global-set-key (kbd "C-x i") 'indexterm-primary-secondary)