As I promised last week, I’d like to describe something I probably knew a long time ago, but completely forgot about.
You can pause an Emacs keyboard macro during its execution.
But wait, there’s more! During recording a macro, you can press C-x q
(this means kbd-macro-query
), and when the macro is run, Emacs pauses there and gives you four choices:
SPC
or y
to just continue,DEL
(this means “backspace”, btw) or n
to skip the rest of the macro (but not subsequent repetitions – this is important when using a numerical prefix argument when calling the macro),RET
or q
to quit this and all subsequent repetitions,C-r
to enter recursive edit or C-l
to recenter screen.That is already pretty cool, but there is even more than that! C-u C-x q
during macro recording enters recursive edit, and that serves two purposes: firstly, you may perform some editing which will not become part of the macro, and secondly, during macro execution, you will also enter recursive edit (and the macro will resume after C-M-c
).
All this is probably not something you would use every day, but it may come handy once in a while – so it may be good to remember that something like this exists. Hopefully I won’t forget about it anymore!