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)))
I'd rather have something like the following:
(fset 'move-line-down
[?\C-a ?\C-k delete down ?\C-y return up])
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?
In order to start recording Emacs keyboard macros you only have to press the <f3> key on your keyboard. The next series of keyboard input commands you use will be recorded in memory. When you have finished the repeatable sequence of keys, press the <f4> key.
Using a “load-file” Function This means you can store your keyboard macros in any file you want and load them via a function in your init file.
Immediately after typing C-x e , you can type e repeatedly to immediately repeat the macro one or more times. You can also give C-x e a repeat argument, just like F4 (when it is used to execute a macro). C-x ) can be given a repeat count as an argument. This means to repeat the macro right after defining it.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With