I’m fond of telling stories about folks using Emacs to solve difficult—or at least complicated—problems but Emacs is probably used more often to solve simple, one-off problems. These problems typically don’t require anything fancier than, maybe, keyboard macros.
Mario Jason Braganza has a nice case in point. The TL;DR is that he made a bulk purchase of comics and wondered how many he got. The site that he bought them from had all the information about the purchase but it included much more than just the titles. Each bit of information was on a separate line and Braganza decided to count just the title lines to see how many comics he had.
So Braganza downloaded the information and pasted it into Emacs. He thought that if he could get rid of the extraneous lines, he could simply do a line count to calculate the total number of comics he had bought.
Experienced Emacers are jumping up and down yelling, “I know, I know”. The answer, of course, was flush-lines
. You simply call flush-lines
, give it a regular expression, and Emacs deletes any lines having a match for the regex. Braganza could, of course, have given it a complicated regex that got rid of all the unneeded lines at once but he chose the simpler—and probably more rational—method of eliminating one type of line at a time. In the end, he had only titles left and a simple line count gave him his answer.
This is, to be sure, a trivial example but it illustrates nicely one of the areas where Emacs shines: simple one-off tasks that would be tedious without the editing power of Emacs. Could you do this in some other editor? Maybe, but why should we care. It works in Emacs and that’s all we need to know.