Emacs:获取可读的键盘宏 [英] Emacs: getting readable keyboard-macros
问题描述
当使用 insert-kbd-macro
保存命名键盘宏时,我得到不可读的Lisp代码,如
When using insert-kbd-macro
to save a named keyboard macro I get "unreadable" Lisp code like
(fset 'ppsql
(lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ([134217788 134217765 44 return 44 17 10 return 33 134217765 102 102 backspace 114 111 109 return 17 10 102 111 109 backspace backspace 114 111 return 33] 0 "%d")) arg)))
我宁愿收到以下内容:
(fset 'move-line-down
[?\C-a ?\C-k delete down ?\C-y return up])
IIRC我使用相同的方法来记录,命名和插入两个键盘宏: F3 , F4 , name-last-kbd-macro
。
IIRC I used the same method to record, name, and insert both keyboard macros: F3, F4, name-last-kbd-macro
.
是否可以以可读格式获取第一个宏?
Is it possible to get the first macro in a readable format?
推荐答案
Emacs中的键盘宏功能有两种模式:宏
和 kmacros
。前者以您喜欢的方式返回宏 - 符号形式 - 后者提供了lambda形式。所以如果你调用 name-last-kbd-macro
,你会得到一个符号表单,如果你调用 kmacro-name-last-macro
,你会得到一个lambda表单。
The keyboard macro functionality in Emacs stands of two modes: macros
and kmacros
. The former returns the macro in a way you like—the symbol form—, the latter provides the lambda form. So that, if you call name-last-kbd-macro
you get a symbol form, if you call kmacro-name-last-macro
, you get a lambda form.
这篇关于Emacs:获取可读的键盘宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!