When I get tired of blogging I'm going to write some Elisp that everyday will make a post that says, “Abo-abo has a great post today. Go read it.” Really, if you don't already have (or emacs in your feed, you should add it immediately. I learn something new from it almost every day.
One of his latest posts is about his refactoring workflow. The problem is to change a function name in every file in a directory. There are multiple subdirectories. How would you do this? I can think of several ways, mostly including
dired and perhaps keyboard macros. Abo-abo has another approach. His steps are
rgrepto get a list of every occurrence of the function name.
wgrepso that you can edit the
rgrepoutput and have the results reflected in the original files.
ieditto change every instance of the function name at once.
wgrep, writing the changes back to the files.
See abo-abo's post for the details.
This is a really outstanding post and I encourage everyone to take a look. I hadn't been using
wgrep but installed them so that I could take advantage of abo-abo's technique.
I've long been a
multple-cursors user so I was interested in abo-abo's use cases for
multiple-cursors and queried him on it. You can read his answer here. One thing that struck me is that he described
iedit as “a drop-in `occur` and `query-and-replace`.” You can see how that works with his refactoring process. Most excellent.