1. Tom Willis
  2. my-emacs-config


Clone wiki

my-emacs-config / Home


Marvel at my crappy lisp skills.

After watching the emacs screencast from peepcode.com and taking a look at their starter kit, I decided to take a stab at reconfiguring my setup in the hopes that I would understand what's going on better.

One motivation for doing it this way is that old joke that emacs is an awesome OS with a crappy text editor, or something like that. So in thinking of Emacs as an OS, I wondered what config would look like if it where something like if it had a *nix style init system. And here's what I came up with basically.

So now my .emacs is very light, like a bootloader(or at least what I understand one to be) it does just enough to defer control to an init.el file.

init.el adds a modes specific configuration directory to the load path, executes defaults.el, then modules.el, then keys.el

defaults.el - generally holds my global settings, or settings I want on all modes

modules.el - contains all the necessary stuff to make other modes available. if the mode comes with emacs already, a simple (require 'mode) is all that is necessary, though if the mode config is extensive you may want to keep it in a separate file and just call load-file from modules.el. This is strictly a convention I'm using, I'm not suggesting you do it.

finally, keys.el keeps my key bindings which I don't have any really.

;;example .emacs
;;emacs files 2010
;;this config gets kind of hairy, attempting to clean it up some to
;;make it more manageable

;;important variables used elsewhere in the scripting
(setq emacs-lib-dir (expand-file-name "~/emacs.d/lib"))
(setq emacs-config-dir (expand-file-name "~/emacs.d/etc"))
(setq emacs-local-dir (expand-file-name "~/emacs.d/local"));;personal lisp

;; add paths to load-path
(add-to-list 'load-path emacs-lib-dir)
(add-to-list 'load-path emacs-local-dir)

;;bring it up
(load-file (mapconcat 'identity (list emacs-config-dir "init.el") "/"))