emacs-devel
[Top][All Lists]
Advanced

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

`custom-file' and init-file [was: user-controlled load-path extension: l


From: Drew Adams
Subject: `custom-file' and init-file [was: user-controlled load-path extension: load-dir]
Date: Wed, 9 Mar 2011 07:42:27 -0800

> >> Another thing I really would like is for customize to
> >> save its stuff in its own file and not in my .emacs. With 
> >> a load-dir this would be trivial.
> >
> > How about this:
> > (setq custom-file "~/.emacs.d/init-custom.el")
> > (load custom-file)
> 
> It is having this in emacs core, working without extra 
> user work that is the point.

My impression is that many Emacs (most?) users are unaware of `custom-file'.
That's too bad, IMO.

I think Emacs should use a separate custom file _by default_ (empty initially),
and thus, by default, keep separate (a) the direct user editing and (b) the
automatic modifications done by Customize.

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

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.

Even if we did not provide a (nearly empty) init file and an (empty)
`custom-file' by default, documenting the use of `custom-file' at the same place
where we document `.emacs' (node `Init File') would be helpful, IMO.  Even just
adding a cross reference there plus a brief mention of `custom-file' would be
helpful.  Today, the `custom-file' doc is buried in the Customization section,
with no mention in the init-file section.

If users did have a default init file and `custom-file' (the former loading the
latter, the latter being empty), then they would more easily keep separate their
own Lisp customizations from any customizations made by Customize.  Mixing the
two is error prone (hence the warning comment we insert today).

Users would be free to add their own Lisp customizations before or after the
load of `custom-file'.  They would also be free to define `custom-file'
conditionally in the init file.  And they could remove the load of `custom-file'
altogether or move it to some other file that gets loaded (i.e. move the load
away from the top level).

IOW, they could do everything they do today.  The only changes would be that by
_default_:

1. Users would have an init file (~/.emacs).

2. The init file would just load `custom-file' (explicitly).  Otherwise it would
be empty.

3. `custom-file' would default to ~/.emacs-custom.el or
~/.emacs.d/user-custom.el or similar (TBD).

Except for #3, I've suggested something similar before (thread "always put
Customizations in `custom-file', never in `user-init-file',
http://lists.gnu.org/archive/html/emacs-devel/2007-12/msg00567.html).

At that time, some were in favor, a few were opposed.  Richard turned it down in
favor of fixing bugs for Emacs 22.  XEmacs apparently already has something like
this (see the thread).

A variant of what's proposed above would be to not have a default init file with
an explicit load of `custom-file', but to just load `custom-file' automatically
after the init file if it is not loaded before then.  This was discussed in the
thread as well.  That too would be OK by me.  (See the thread for details.)

The discussion in that thread also dealt with the possibility of automigrating
existing Customize customizations from .emacs to `custom-file'.  Leaving out
migration altogether - or at least making it optional (on-demand) - would
perhaps lead us to an easier consensus about using `custom-file' by default. 

Perhaps this topic is worth revisiting?




reply via email to

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