Torstein Johansen on Keyboard Macros & Multiple Cursors

Torstein Johansen, who’s been using Emacs for 20 years, has a shocking confession: Although he learned about them, he’s never used keyboard macros. Part of the reason for that, he says, is that he uses multiple cursors instead. My first impression was, “But multiple cursors was just introduced 3 or four years ago.” Actually, Sveen’s famous Emacs Rocks! video on multiple cursors was 10 years ago so it’s more than possible that lots of people have always used it in preference to keyboard macros.

Regardless, Johansen set out to remedy the situation by getting serious about macros and recording a short video on how to use them. The video uses macros to solve a simple reformatting problem and then solves the same problem with multiple cursors for comparison. The amount of work is pretty much the same—especially if use the repeat macro to end of buffer command instead of repeating it for each line—but multiple cursors does take a few less keystrokes.

The video illustrates a problem with multiple cursors that I mentioned in my Are Multiple Cursors Suboptimal? post: there are several commands devoted to placing the initial cursors that you have to know whereas you can do real work with keyboard macros by just knowing how to start and end the macro recording. I like the F3 and F4 keystrokes for that especially since F4 will replay the macro after it’s been recorded.

All in all, the video is a nice introduction to using keyboard macros and it’s short (3 min, 31 secs) so there will be no problem finding time for it. The video does not cover everything you can do with macros but just knowing the simple commands Johansen illustrates will cover 90% of everything you want to do.

This entry was posted in General and tagged . Bookmark the permalink.