[Top][All Lists]

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

Re: Changing a customizable variable programatically?

From: Klaus Berndl
Subject: Re: Changing a customizable variable programatically?
Date: 18 Sep 2002 10:00:32 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1

On 17 Sep 2002, Joe Casadonte wrote:

>  Is there any way to change a defcustom'ed variable programatically,
>  and then have it saved via the custom mechanism for future use?  I
>  basically want to give users two ways to change this particular
>  variable, one via a custom buffer, and one "in context".  Is it as
>  simple as calling `custom-save-variables'?  Any comments on breaking
>  the paradigm in this way?  Thanks!

It is so simple! Look into the file the option *custom-file* points to
(if nil then the file the variable *user-init-file* points to) and you will
see there is nothing else then onw big `custom-set-variables' call.

The only important thing for changing defcustom-options via elisp is not to
use `setq' (or `let') because then all the :set, :initialize (and other)
clauses of the defcustom-form will no be evaluated which can result in
unwanted effects!

But i strongly recommend always using the customize-feature of Emacs for
changing defcustom-options!

BTW, just for my interest: What do you mean with "in context"??


Klaus Berndl                    mailto: address@hidden
sd&m AG               
software design & management    
Thomas-Dehler-Str. 27, 81737 M√ľnchen, Germany
Tel +49 89 63812-392, Fax -220

reply via email to

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