Once again, I lost track of Sahas Subramanian’s Emacs through macros videos and while I wasn’t looking he’s posted 3 more. Number 7 is about grep and doesn’t use macros in any significant way. Number 8 is an exercise that you can try to test your keyboard-macro-fu. You can check those out yourselves. The last one, number 9, considers the common task of renaming files. There are, of course, lots of ways of doing this using things like mutliple cursors, iedit, or even the Dired R command.
Subramanian shows how to do it with a simple macro. He’s in a dired buffer and wants to change the names of the files containing his videos. They’re all of the form
Learning Emacs with Macros - nn.webn
where nn
is the number of the video. He wants to change them to better reflect the name used on YouTube so he wants them in the form
Emacs Through Macros - nn.wbm
He steps through the first recording a keyboard macro and then applies the macro to the remaining entries. It’s a pretty simple operation and if you have macro experience, you’ll have no problem figuring out what he did. If you’re new to macros, take a look at the video to see how he did it.
The video is only 2 minutes 55 seconds so you should have no problem finding time for it.