My Emacs initialization files
Emacs Lisp Other


Welcome to my Emacs initialization files.

The main initialization file is emacs.el, which is loaded as part of a machine-specific bootstrap process.


I use ELPA, the Emacs Lisp Package Archive, but don’t check that directory into this repository.

Load Path

The global variable *my-emacs-lib-dir* must be defined to point to this directory.

The load path is set up to look in the Emacs installation first, then in *my-emacs-lib-dir*.

Bootstrap Process

Since I use Emacs on multiple machines, I came up with a customization scheme that lets me run “before” and “after” code for each machine around my main initialization code. Each domain (work, home, etc.) gets its own subdirectory and each machine gets its own subdirectory within the domain. Inside that are up to four files: dot_emacs, before.el, after.el, and the bookmark file emacs.bmk (which is not checked in to source control).

On each box I create a soft link from the appropriate init.el file in that machine’s bootstrap/DOMAIN/MACHINE directory to ~/.emacs.d/init.el. Here’s the init.el file on the machine I’m using right now, which is really a link to ~/.emacs.d/elisp/home/sysex/init.el:

;; -*- emacs-lisp -*-
(defvar *my-emacs-lib-dir* "~/Library/elisp/")
(load-file (concat *my-emacs-lib-dir* "bootstrap-init.el"))
(bootstrap-init "home" "sysex")
(when (fboundp #'package-initialize)

See bootstrap-init.el. bootstrap-ini sets some global variables, defines the value of custom-file, and loads it. Since package-initialize now insists that it be put in init.el, I load it here explicitly before calling bootstrap-load instead of having it loaded elsewhere.

bootstrap-load finds the directory containing the customization files for the machine defined by bootstrap-init. It then runs the “before.el” file in that directory, then my main customization file “emacs.el”, then the “after.el” file.

Note that the variable *my-emacs-lib-dir* must be defined before calling bootstrap-init. Yes, we could pass its value into that function, but since it is used and assumed to exist elsewhere, that function might as well assume it exists.

Key Bindings

emacs.el loads keys.el which does pretty much the same thing that the bootstrap process does: it defines my normal key bindings then loads the keys.el file in the bootstrap directory specified earlier.

See Also

See also my Emacs tips page.