help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

An alternative to a monolithic ~/.emacs init file


From: Sebastian Tennant
Subject: An alternative to a monolithic ~/.emacs init file
Date: Tue, 30 Oct 2007 17:04:35 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1 (gnu/linux)

My ~/.emacs reads like this:

 ;;; generate auto-autoloads.el in ~/elisp/dotemacs/
 (let ((generated-autoload-file "~/elisp/dotemacs/auto-autoloads.el")
       (backup-inhibited t))
   (apply 'update-directory-autoloads '("~/elisp/lib/"))
   (kill-buffer (file-name-nondirectory generated-autoload-file)))

 ;;; load dotemacs/*.el  (including auto-autoloads.el)
 (mapc (lambda (f) (load f))
   (split-string
     (shell-command-to-string "find ~/elisp/dotemacs -name *.el")))

That's it, essentially.

With this arrangement, library functions I've written that I don't
always want to load at startup, but I do want to have to hand, go in
~/elisp/lib, and customisations (and functions I do always want to load
at startup) go in ~/elisp/dotemacs.

I can put my customisations and functions in as many .el files as I like
within their respective directories, making it much easier to organise
things generally.

And to ensure a library function is always to hand (but not loaded) I
simply need to remember to include an autoload cookie (;;;###autoload)
in the library file, and an autoload form will be dynamically
constructed and called at startup, i.e., there's no longer any need to
write autoload forms manually any more.

It's a win-win is it not?  It works for me.

Sebastian






reply via email to

[Prev in Thread] Current Thread [Next in Thread]