My .emacs

Emacs wizards will tell you that it is not merely a text editor, but an operating system; not just a way to work, but a way of life; not only a thing they use, but a thing they are. After having used Emacs for nearly ten years now, I see that it's all true.

More often than not, when someone asks me how I do something, like generating percentile feedback work graphs, making epic time-lapse videos, and figuring out what's important in life (see the Experiential Sampling section)–I have to say something like, "Well, it's pretty straightforward, I just have an Emacs post-save hook in my org-mode buffer that runs a Python script to parse my Emacs timestamps and POST the JSON to App Engine where it's graphed by Highcharts and also sends an NSDistributedNotification so that my Telepath heads-up display can update its embedded UIView pulling the same graph from my website. The only thing missing is authenticating to the Beeminder API, heh heh! Come to think of it–"

No. What? No, they say, I mean, like an app. For my phone. What?

Oh, right. I've inadvertently become an arcane Emacs techno-amoeba to them.

Part of cyborg-merging with Emacs is that you often read blog posts from other Emacs users who share their .emacs file configuration code that customizes their Emacs. These blog posts tend to be 20% irrelevant, like when you don't watch YouTube within Emacs; 20% heretical, like configuring Python mode to do `newline-and-indent instead of just `newline when you press return; and 60% life-changing-if-only-you-can-remember-to-use-it, like actually using Emac's magit mode instead of going to the terminal and git noob-ing out.

Here is a good example of this kind of post: Nuggets from my .emacs: Part I. The author is a badass Emacs Wizard who writes his blog in Emacs and probably walks his dog in Emacs. Look, he's even modularized his entire .emacs config and put it on GitHub for all to study. It is beautiful. His first tip makes me feel like an elementary Emacs user for never bothering to resize my Emacs windows but instead semi-randomly mashing "new window" and "close window" and "undo that last stuff with my windows" shortcuts until they're adequately arranged. Whatever, I don't need that. The next three tips would have saved me approximately five seconds times a baprillion uses over the past ten years, and I weep that I've been so inefficient in my Emacsing. I instantly copy them into my own .emacs.

It's always like this. As a result, I now have an 840-line-long .emacs configuration file, jammed with helpful shortcuts I use surrounded by elite guilt-guards of helpful shortcuts I've forgotten, random comments linking to dozens of these blog posts, entire sections that were commented out when I couldn't get them to work yet, 50 lines of Chinese font stuff that I'm pretty sure does nothing, and configurations I've forgotten I've configured that would leave me utterly helpless to try to do anything in someone else's Emacs.

So in tribute to the well-organized and life-changing .emacs snippet blog posts that made me this way, I thought I'd peer into the depths and unearth a few of the most essential cornerstones of my .emacs.

1. How could one use browse-url mode without this?

What if it defaulted to Netscape?!

2. Fix annoying auto-save tempfile defaults with careful configuration.

Or not. No, no need to comment that stuff out; we'll just add a line at the end to turn it off afterwards.

3. Maksym's idea.

Bad idea. Definitely gotta keep it around, though. What if I forget how bad an idea that was?

4. The bread and the butter.

Here is a classic section. At some point, I went out of my way to un-disable the upcase-region and downcase-region commands. I have never used them. I also bound an entire function key to a mode which puts line numbers next to each line, apparently. I did not know that.

I then go on to try to use python-mode and ipython, presumably having opened each once after reading about them in some Emacs blog post and shortly before my excitement turning to ash under my fingers as I realized how weird and picky my syntax highlighting preferences are.

Then there's the sad story of an entire morning wishing that I knew why Emacs wanted to load thousands of buffers whenever I opened it or that it would listen to my voodoo dances of repeating the command in different places to limit it to 250. I still don't know if that works.

5. The magic.

This is now actually a core part of my life, which tells the Python program to read work timestamps from my gigantic everything file and upload them to my website. Since I, uh, experimented with Scheme in college, I sort of know how this little bit works, but it would take me an hour with Google to rewrite it.

6. That one actually useful bit.

Friends don't let friends use the default audible bell noise whenever you do an invalid command, which is always. Of course, now that I look it up on EmacsWiki, you could instead use 27 lines of Emacs Lisp to spawn two processes to flash the Scroll Lock light on your keyboard. Maybe I'll paste those into my .emacs instead and go take my ultimate IBM keyboard with an actual Scroll Lock key back from George to hasten my degeneration into an ancient Emacs amoeba...


Hacking on CodeCombat, a multiplayer programming game for learning to code. Mastermind behind Skritter, the most powerful Chinese character learning app.

More posts from

Bantling: Name Your Baby With Algorithms

When Chloe and I were trying to come up with baby names, every conversation would go something like this:Chloe: "New...

My .emacs

Emacs wizards will tell you that it is not merely a text editor, but an operating system; not just a way to work, bu...

The 120-Hour Workweek - Epic Coding Time-Lapse

Last week I set out to see how many hours of programming work I could do in one week on CodeCombat, our multiplayer ...

Upcoming Maniac Week

Starting Monday morning at 04:00, and ending the next Monday at 03:59, I'm going to see how many hours of CodeCombat...

Telepath Logger Now Open Source

A while ago I was working with Yoni on Telepath, a project to make your laptop do passive machine learning on your e...


All Topics