Emacs Configuration Management – Part I

0

I love Emacs – I use it for everything. Local file editing, remote file editing via Tramp, terminals, calendars, email, news groups, rss / atom feeds, reminders, time keeping, todo lists, document generation (from org-mode) – literally just about everything I can.

As you can imagine that amount of usability takes quite a bit of customization. Luckily, the Emacs community has done most of the heavy lifting. All that I have to manage is my own programmatic idiosyncrasies and – the init.el…

It became huge, and messy, and cumbersome. And like any good programmer it made me feel dirty – it needed organized and modularized. But again like any good coder – I didn’t want it to be manual. I wanted drop-in, auto-discover modularity that didn’t require any additional scripting.

Like most things coding (when you don’t know what you are doing) you start out on a quest to discover what’s available in the language of question for you to leverage. And that, to me, is the fun part – the acquisition of knowledge. The problem at hand is just a reason for you to dig deeper and learn – but I digress…

This post – like most of mine – is segmented. Mostly because I’m long-winded when discussing this material. However, I think this one is pretty good and you should come back to read the follow-ups. Why? Because of the snippet to follow and this explanation:

I currently have over 41 csutomization emacs .el files (1 or more for each mode / package) and my init.el file is simply:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
;; set up path helpers
(setq my-emacs-d "~/.emacs.d/")
(setq my-emacs-elpa (concat my-emacs-d "elpa/"))
(setq my-emacs-conf (concat my-emacs-d "emacs-conf/"))
(setq my-emacs-live (concat my-emacs-d "emacs-live/"))
(setq my-emacs-org (concat my-emacs-d "emacs-org/"))
(setq my-emacs-3p (concat my-emacs-d "third-party/"))
(setq my-site-file "~/site_conf.el")
 
;; load site file if it exists
(if (file-exists-p my-site-file) 
    (progn
      (load my-site-file)
      (find-file my-site-file))
)
 
;; load various configurations
(load (concat my-emacs-conf "configurations_config.el"))
 
;; will load and byte-compile my modular configurations
(my-load-configurations)

I can add a thousand configuration files – and my init.el never will get any larger. The key? My configurations_config.el – which isn’t as crazy as you’d think it would be. I like to think it’s a thing of beauty – but you can weigh in on my next post when we dig into it!