如何在我的Emacs init文件中生成键盘宏?

zin*_*ing 3 emacs macros

我经常定义一个特定的键盘宏,所以我认为如果每次加载Emacs时它都自动可用它可能会很方便.

我怎样才能做到这一点?

eve*_*_jr 5

如何保存手册中的键盘宏部分?

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.
Run Code Online (Sandbox Code Playgroud)

  • 这就是`insert-kbd-macro`所做的:"要保存kbd宏,请访问一个Lisp代码文件,例如你的`〜/ .emacs',使用此命令,然后保存文件." (4认同)