Project Notes.

Persecution Complex

By peter on December 16, 2005 | Permalink



If you are offended by discussion about Emacs, please stop reading now.

Over the last few years, Dan Mills and I have been improving an Emacs configuration style we both enjoy using. There has recently been some interest in this setup internally, so I thought I'd pull some notes together and send it out into the world.

There were two original goals for this design:

  1. A good, clean configuration—none of the mess that usually clutters .emacs files.
  2. Easy deployment of new elisp packages.

The configuration comes down to three things.

First, all the elisp files I own, either packages I've downloaded or things I've written myself, should exist under one tree. This eases maintenance, and allows me to keep everything in Subversion.

Second, all the relevant directories in that tree should be automatically added to the Emacs load-path, so I don't ever have to add anything manually when I want to try out something new.

Third, configuration files should be loaded automatically—I want to be able to drop settings in and not have to edit a file to get them to load.

Here is the result:

  • All directories under ~/elisp that contain elisp files are added to my load path.
  • All *-settings.el files under ~/elisp/settings are loaded automatically on start.
  • Customized variables (M-x customize, that is) are saved in ~/elisp/custom.el.

Whenever I download something new and nifty, I put it in ~/elisp/packages. If it's a single file, I'll put it there directly. If it comes as several files (or even a deep tree), I'll put it in its own subdirectory. I add a settings file that loads that package, and off I go.

These settings files are often extremely short—all I want to do there is set the configuration variables I need to use the package.

I keep my .emacs file itself as simple as possible—it's not in the version controlled tree, and I tend to forget changes when I make them. At the moment, it has one line—hopefully it's simple enough for me to remember if I lose it:

(load-file "~/elisp/init.el")

A sample elisp tree containing that init.el file can be found here. There's a fair amount of documentation in the comments of init.el.