Many improvements cribbed from Steve Purcell's .emacs.d.