I usually use keyboard macros to repeat some editing operation that’s too complicated for iedit, multiple cursors, or search and replace. It’s astounding how useful it can be and every Emacser should learn to use them.
Recently, Arne Babenhauserheide tweeted a link to an old post of his on how to use macros to ease drudgework. The boring chore he wants to streamline is (basically) to update a LaTeX table with a column having an identifier for each entry by searching for the all instances of the identifier in a config file and using the information found to update the table. The basic strategy is to move down the table row-by-row, use that row’s identifier as the target for an occur
in the config file, and copy the necessary information from the occur
results into the table.
Babenhauserheide automates a lot of the process with a keyboard macro. What’s significant about the macro is that it’s being used to help with a search rather than to edit some text and that the macro “visits” multiple windows. That last aspect is reminiscent of abo-abo’s use of a similar strategy in one of his refactoring processes.
Babenhauserheide’s post serves as a reminder that keyboard macros have more power than we usually take advantage of.