[Top][All Lists]

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

Re: Customization problem

From: Herbert Euler
Subject: Re: Customization problem
Date: Tue, 31 Oct 2006 20:35:46 +0800

    For example, add a variable `custom-variables-loaded', which defaults
    to nil, and add the expression

        (setq custom-variables-loaded t)

    as the last expression of the function `custom-set-variables'.  Then,
    `custom-save-variables' can test this variable to determine whether
    to report an error.

That will give the wrong result in the case where .emacs is successfully
loaded but there is no `custom-set-variables' in it.

Currently, the user can save preferences and customizations into a
file, either ~/.emacs or a specified file.  More precisely, into the
file whose name is returned by `(custom-file)'.

The function `custom-file' works in this way: If the variable
`custom-file' is not nil, it returns the name of the file
`custom-file' points to.  Otherwise, it returns the name of
`user-init-file' (~/.emacs), if saving settings is permitted.

If we decide to protect the customizations from being cleared
accidentally, we must prevent the situation that a file which contains
the application of `custom-set-variables' is to be loaded but the
application of `custom-set-variables' in the file is not evaluated
(because of errors, for example) happening.

To achieve this, one of the following conditions must be satisfied:

[1] The application of `custom-set-variables' is evaluated before any
   other forms in a file.

[2] If a file contains the application of `custom-set-variables', the
   file is identified.  If the application of `custom-set-variables'
   in the file is not loaded, let `custom-save-variables' signal
   errors.  Otherwise, `custom-save-variables' just behaves as usual.

[3] If a file contains the application of `custom-set-variables', any
   error in the evaluation of the forms before the application is
   ignored so that the application of `custom-set-variables' is
   guaranteed to be evaluated.

[4] The mechanism of customizations saving is changed so that the
   application of `custom-set-variables' is guaranteed to be

For [1] and [2], searching every file for the application of
`custom-set-variables' is a waste.  [3] is not acceptable.  For [4],
the current feature of user defined customization file has to be
disabled.  We could load a file `user-customizations.el' in
`loadup.el' or `startup.el', so the evaluation of the application of
`custom-set-variables' is separated from the user defined forms and
can be always evaluated successfully.

Guanpeng Xu

Don't just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/

reply via email to

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