Seven or eight years ago when Tim Visher was still producing his VimGolf in Emacs videos, one of his favorite tricks was using the full power of Emacs keyboard macros. Most Emacs users know about keyboard macros and can manage straightforward applications of them to perform a repetitive task. Visher, though, was a master and knew how to use them interactively to accomplish amazing things.
One of his tricks was to place a prompt for a query in the middle of a macro that would allow the user to perform some special action specific to the current item the macro was on (see this episode for example). I learned those methods at the time but because I seldom have need to use them, I’ve mostly forgotten about them.
Happily, Marcin Borkowski (mbork) recently posted an update to his previous post on keyboard macros that I wrote about last week. In his new post, he talks about pausing a macro and also about adding a query prompt that allows you to enter a recursive edit and perform an action unique to the current item. It’s really great to be reminded of this because while I may not need it often, when I do it’s extraordinarily useful. Take a look at Borkowski’s post for details on how to add a query to a macro. As I say, you probably won’t need it too often but when you do, you’ll be glad you now how.
UPDATE
: Added link to Borkowski’s post.