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

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

Re: An alternative to a monolithic ~/.emacs init file


From: Francisco Miguel Colaço
Subject: Re: An alternative to a monolithic ~/.emacs init file
Date: 11 Nov 2007 00:09:47 GMT
User-agent: Pan/0.129 (Benson & Hedges Moscow Gold)

Thu, 08 Nov 2007 11:53:08 -0800, rustom wrote:

> On Nov 8, 6:08 pm, Sebastian Tennant <seb...@smolny.plus.com> wrote:
>> Quoth rustom <rustompm...@gmail.com>:
>>
>> > Could you please elaborate on how this works a little?  [...] I
>> > really would like to have a tiny little .emacs file and a bunch of
>> > files and directories containing unrelated stuff
>>
>> If you don't care about autoloads (or you're not sure what they are)
>> and you just want a small ~/.emacs, then all you need is this:
>>
>>   ;;; load dotemacs/*.el
>>   (mapc (lambda (f) (load f))
>>     (split-string
>>       (shell-command-to-string "find ~/elisp/dotemacs -name *.el")))
>>


I use the following .emacs:

(set-language-environment "UTF-8")
(setq user-full-name "ABCDE"
      user-initials "abc"
      user-mail-address "abc@cde.com"
      user-dir-library "~/.local/share/emacs"
      user-dir-configuration "~/.config/emacs"
      user-dir-cache "~/.cache/emacs"
)

(setq load-path (append load-path (expand-file-name user-dir-library)))

;;; Define some needed functions.
(defun user-conf-filename (filename)
  "Gets the path of a configuration file, whose name is given.

  FILENAME is path appended to 'user-dir-configuration'.
  "
  (concat user-dir-configuration "/" filename))

;;; Load the user configuration.
(load (user-conf-filename "conf-user.el"))

Well, this puts all files within ~/.config/emacs.  Even ~/.emacs is a 
symlink to ~/.config/emacs/dotemacs.  This way:

1. I can zip all my emacs configuration by zipping one directory.
2. all I have to do is put in conf-user.el expressions like:

  (load (user-conf-filename "conf-fonts.el"))

  Of couse, I also maintain custom.el in the ~/.config/emacs directory by 
issuing, in .config/emacs/conf-user.el:

  (setq custom-file (user-conf-filename "custom.el"))
  (load custom-file)

  and all the emacs-specific files like ~/.projects.ede are moved intyo 
the directory by issuing the correspondent customize commands or setting 
their names in .emacs

  Works like a charm.

    Francisco Colaço


reply via email to

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