Thursday, June 24, 2010

Emacs the Lifesaver

I was not thrilled of the task in front of me. Refreshing an old mega-patch, revise virtually every hunk to use a different interface, and committing it piecemeal to the repository again. Sounds like a long error prone job of suffering.

Fortunately here is where the power tools come in. I
  1. re-merged the backed out revision, postponing conflicts;
  2. saved the diff away and reverted the repository;
  3. wrote a small awk script to massage the hunks in the diff to get a new patch;
  4. fired up emacs with the patch and applied each hunk after thorough review (and seldom with minor changes);
  5. some hunks are not ready to go in yet as they do not qualify as refactoring, these are kept for later;
  6. commit almost every file as a separate revision.
I spend the most time in Emacs (the Mac OS X incarnation, Aquamacs is fantastic). It provides me all the comfort and productivity I need:
  • it provides all necessary hunk operations such as apply, reverse, go to original, drop etc.
  • I can transparently work from a remote machine via ssh, including editing, version control and the above diff operations
  • peace of mind, by being rock solid and autosaving stuff.
The only inconvenience is the sheer amount of keyboard equivalents, but I am getting used to them too.

Thanks Emacs, without you I would probably drop!

No comments: