Raw Syntax

The stuff programs are made of

Learn Emacs: The Extensible Editor


Emacs bills itself as being the extensible self-documenting editor. When I first started using it I was suspicious that not many people take advantage of the extensible part. I could not have been more wrong. What follows is a short story of a hack to get Emacs to do what I want.

Making Emacs Work for Me

I use ack-and-a-half to interact with ack (instead of grep) via Emacs. Some time ago I read about ag, but there wasn't an Emacs mode for it available. I checked again last week, and found that there is now ag.el. After trying it, I found that it doesn't work exactly like ack-and-a-half. I wanted to switch to ag, but did not want to give up ack-and-a-half's behavior.

So I did the emacs thing and had a look at ag.el's source to assess how much effort changing it would be. It was too much effort. I then realized due to the close compatibility between ack and ag, I could probably quickly hack up ack-and-a-half to change the backend to ag.

After an hour of work ag-and-a-half was born. The result is that my former ack-and-a-half frontend now runs 3x-5x faster (ag's performance promise). The work that I did was largely a wholesale find and replace. The right thing to do would be to make the backend swappable between ack and ag. However, the quick hack works great for now.

I find this is a good example of Emacs' extensibility and an example actually taking advantage of it. If you're using Emacs without customizing or extending it, you're missing out.