emacs-devel
[Top][All Lists]
Advanced

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

`custom-file' and init-file


From: Stephen J. Turnbull
Subject: `custom-file' and init-file
Date: Thu, 10 Mar 2011 02:54:02 +0900

Drew Adams writes:

 > I would be in favor of having `custom-file' default to
 > ~/.emacs-custom.el or ~/.emacs.d/user-custom.el or something.

FWIW, XEmacs uses the following scheme.

(1) The startup code automatically loads custom-file, if non-nil and
    it exists, *after* loading the init file, if that exists.
    (custom-file will be loaded if init file doesn't exist.)
(2) custom-file defaults to (the equivalent of) .emacs.d/custom.el.

Note that the custom file does not need to be on the load-path since
it has its own location variable, so the name conflict doesn't cause a
problem.  I've not heard of a real issue about the name in 15 years of
use of this scheme.  My own experience is that it's only an issue if
I'm working on lisp/custom.el, in which case it's often prompted by
some problem with ~/.xemacs/custom.el, and then the buffer name
conflict is mildly annoying.

 > By itself, that wouldn't clue users in.  A separate question would
 > be whether to also have an (almost) empty `.emacs' by default,
 > containing just an explicit load of `custom-file'.  I'd say yes.

Note that having a explicit load would require either a conditional or
that custom-file exist.  The XEmacs scheme makes this set of issues
moot.

The only real problem with the XEmacs scheme is that some people have
init files that depend on the custom file.  In that case the remedy is
somewhat ugly but effective.  Add

(load custom-file)
(add-hook 'after-init-hook `(lambda () (setq custom-file ,custom-file)))
(setq custom-file nil)

early enough.



reply via email to

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