My .emacs file loads ~/.emacs.d/init.el, which defines the following functions, written first for XEmacs, but working well enough for Emacs these days:
(defconst user-init-dir
(cond ((boundp 'user-emacs-directory)
user-emacs-directory)
((boundp 'user-init-directory)
user-init-directory)
(t "~/.emacs.d/")))
(defun load-user-file (file)
(interactive "f")
"Load a file in current user's configuration directory"
(load-file (expand-file-name file user-init-dir)))
Then the rest of the file goes and loads lots of individual files with forms like this:
(load-user-file "personal.el")
My current set of files is as follows:
- personal.el
- platform.el
- cygwin.el
- variables.el
- paths.el
- mail-news.el
- misc-funcs.el
- bbdb.el
- calendar.el
- gnus-funcs.el
- c-and-java.el
- lisp.el
- clojure.el
- go.el
- markdown.el
- sgml-xml.el
- tex.el
- spelling.el
- org.el
- packages.el
- fonts.el
- color-theme.el
- frame.el
- server.el
- keys.el
- aquamacs.el
Some of them are much more specific in intent than others, as the names suggest. The more fine-grained the files, the easier it is to disable a cluster of forms when you’re reinstalling a package or library. This is especially useful when “moving in” to a new system, where you drag your configuration files over but don’t yet have all the supporting packages installed.