Category Archives: prelude

Prelude init.el & org-babel

Prelude is a very nice Emacs 24 configuration. Private settings are stored under ~/.emacs.d/personal, so it’s easy to keep things clean. The only thing I missed was the possibility to use org-files for my private configuration, something I like in the Emacs Starter Kit. Using org-files for configurations helps to document, and add references to stuff to try out later.

The following change to init.el makes it possible to use org-babel:

;; config changes made through the customize UI will be store here
(setq custom-file (expand-file-name "custom.el" prelude-personal-dir))

;; load the personal settings (this includes `custom-file')
(when (file-exists-p prelude-personal-dir)
  (if (directory-files prelude-personal-dir 't "^[^#].*org$")
    (message "Loading personal configuration org-files in %s..." prelude-personal-dir)
    (load-file (expand-file-name "custom.el" prelude-personal-dir))
    (require 'org)
      (mapc 'org-babel-load-file (directory-files prelude-personal-dir 't "^[^#].*org$"))))
      (message "Loading personal configuration files in %s..." prelude-personal-dir)
      (mapc 'org-babel-load-file (directory-files prelude-personal-dir 't "^[^#].*el$") ))

If there are org-files in ~/.emacs.d/personal then load org-mode and use org-babel, otherwise just load all the elisp files.

Note: if you use the org-files, then you have to load custom.el by hand, as it’s skipped otherwise.