I’ve written a couple of times about Tim Visher’s VimGolf In Emacs series of videos. If you’re an Emacs user and haven’t taken a look at them yet, you should do so without delay. They are very informative and entertaining.
Now Mickey Petersen over at Mastering Emacs has gotten into the act. That makes me very happy because I really enjoy seeing how other Emacs users solve editing problems. I almost invariably learn something useful by watching or reading those solutions. Mickey’s take on the problems is a little different from Visher’s. He says up front that there’s no way Emacs is going to be as efficient in terms of keystrokes as Vim and instead he concentrates on finding a general—or as he says, technically correct—solution. By that he means a solution that works for bigger or smaller data. The problem with VimGolf solutions is that they tend to be crafted for the particular piece of data that’s being edited. That’s because in order to minimize keystrokes the solution has to be tailored to the specific data in the problem.
The problem that Mickey considers is to sort the following records into alphabetical order by people’s names.
## Directory * Smith, George - 1234 Avenue, New York, NY * Bailey, Stephen - 4545 Harbor Ln, Atlanta, GA - Phone: (412) 291-1238 * Thomas, Brent - 1482 Mystic Oaks, Anaheim, CA * Grant, Jenny - 198 Circle Dr, Houston, TX - Phone: (213) 198-9842 - Email: firstname.lastname@example.org * Percy, Adam - 221 Jaguar Pkwy, Missoula, MT * Garfield, Misty - 5988 Apple Tree Ln, Memphis, TN * Parsons, Betty - Phone: (235) 523-2378 - Email: email@example.com * Sanders, Terry - Email: firstname.lastname@example.org * Smith, Pete - Phone: (294) 984-2938 * Frost, Jennifer - 2498 Temple Terrace, Miami, FL * Matthews, Frank - 418 Happy Trail, Phoenix, AZ - Phone: (985) 129-2394 - Email: email@example.com * Allen, Taylor - Email: firstname.lastname@example.org * McCullen, Sarah - 247 Hidden Elm, Seattle, WA - Phone: (288) 283-4568 * Perkins, Mike - 992 Peartree Ln, Bowling Green, KY
Think for a second or two how you might do that in Emacs and then jump over to Mickey’s post to see how he leveraged the power of Org-mode to solve the problem. It’s a brilliant solution and with
smex installed is probably competitive with the Vim solutions even without trying.