我经常定义一个特定的键盘宏,所以我想如果每次加载Emacs时它可以自动可用就会很方便。我该怎么做?
手册中的保存键盘宏部分怎么样?
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.
insert-kbd-macro
的作用是:“保存键盘宏,访问一个 Lisp 代码文件(例如你的 ~/.emacs
),使用该命令,然后保存该文件。” - user725091global-set-key
将您的命名宏绑定到一个按键上。 - event_jrdefalias
和kmacro
-- 例如,要执行C-c a a
,只需将以下内容放入你的初始化文件中: (defalias 'start-org-agenda
(kmacro "C-c a a") "Start the org-mode agenda for the current day.")