SiteMap Search ElispArea HowTo Glossary RecentChanges News Problems Suggestions

DotEmacsModular

EraEriksson created a simple library for keeping your DotEmacs simple by allowing you to divide it into a modular collection of files. It’s called my-site-start and can be downloaded from http://porkmail.org/elisp

By default it will recursively load all files and directories starting from ~/.emacs.d/site-start.d/ but this can easily be customized to use a different directory, not recurse, etc.

The library is just a simple framework for loading a modularized set of startup files. It does not include any functionality to actually create this modularized set of files.

As of 2009-02-05 this should be considered beta software. The author would appreciate any comments from users; please email ee are aye plus ee el eye es pea at eye kay eye dot ef eye.

Works well in my experience. It echoes Debian’s design for /etc/emacs/ - not sure which came first.

It’s theoretically neat to be able to activate a package for personal use just by symlinking its startup file into ~/.emacs.d/site-start.d/, but I don’t know of any package that uses this method of installing or which supports soft-linking correctly in its startup file. In order to set the load-path correctly even when visited thru a soft symlink, you can write:

(if load-file-name
   (add-to-list 
      'load-path 
      (file-name-directory (file-truename load-file-name))))

For multi-file packages, there is unfortunately no convention to indicate to the user which file is the Right File to symlink.

Debian already included a method like the mentioned my-site-start: It’s called debian-run-directories defined in file /usr/share/emacs/site-lisp/debian-startup.el in package emacsen-common. So I put in my .emacs.d/init.el

(setq dotfiles-dir (file-name-directory (or load-file-name (buffer-file-name))))

(let ((user-site-start-dir (concat dotfiles-dir "/site-start.d")))
    (debian-run-directories user-site-start-dir))

CategoryDotEmacs