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.
The global variable *my-emacs-lib-dir*
must be defined to point to this
directory. That is done automatically in bootstrap-init.el
, but you can
always override it if you need to.
The load path is set up to look in the Emacs installation first, then in
*my-emacs-lib-dir*
.
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 there are a number of files, all optional: before.el
, after.el
,
keys.el
, custom.el
, and the bookmark file emacs.bmk
which is not
checked in to source control.
On each box I create a small init.el
file in that machine’s
user-emacs-directory
which looks something like this:
(load-file "~/.emacs.d/elisp/bootstrap-init.el")
(bootstrap-init "home" "sysex")
See bootstrap-init.el for the definition of bootstrap-init
. That function
finds the directory corresponding containing the customization files
corresponding to its args. It then runs the before.el
file in that
directory, then the main customization file emacs.el
, then after.el
.
The bootstrap process sets a number of variables including custom-file
,
*my-emacs-lib-dir*
, *my-emacs-bootstrap-domain*
, and
*my-emacs-bootstrap-machine*
.
The shell script setup.sh
creates the init file and does a few other
things.
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 my Emacs tips page.