emacs-devel
[Top][All Lists]
Advanced

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

Re: always put Customizations in `custom-file', never in `user-init-file


From: Lennart Borgman (gmail)
Subject: Re: always put Customizations in `custom-file', never in `user-init-file'
Date: Mon, 10 Dec 2007 22:25:02 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666

Stephen J. Turnbull wrote:
Lennart Borgman (gmail) writes:

 > Drew Adams wrote:
 > > I think it was probably a mistake ever to have put Customize customizations
 > > into a file intended for editing. That can confuse users, and it's just
 > > asking for trouble. Now that we have a good alternative (`custom-file'), I
 > > think that should be used exclusively.
 > ...
 > > WDOT?

Be very careful.  In particular, the natural idea of migrating by
loading the init file and using Custom to save its internal state to a
custom-file caused no end of pain to users when it was implemented in
XEmacs.  If there is any error in the init file, you can lose all
customizations.

Then it might be best to avoid automatic migration, but to give a command to migrate custom data to custom-file.

> Great. And I guess custom-file should be run after .emacs, since that > makes it possible to chose another custom-file.

Experience in XEmacs showed that users often want to use information
in the custom-file in their init files.  There were issues (maybe
XEmacs-specific) with initial values for faces, too.  After the init
file was run was too late.  It's easy enough to load the custom-file
late for those users for whom that matters: don't use the default
name.  Something like

(defvar custom-file "custom.el")
(defvar default-custom-file-loaded-p nil)
(progn
  (do-emacs-early-initializations)
  (when (file-readable-p custom-file)
    (load custom-file))
  (load user-init-file)
  (when (and (not default-custom-file-loaded-p)
             (file-readable-p custom-file))
    (load custom-file)))

Yes, you are of course right.




reply via email to

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