help-gnu-emacs
[Top][All Lists]
Advanced

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

RE: Replacing custom-set-variables


From: Drew Adams
Subject: RE: Replacing custom-set-variables
Date: Sat, 13 Sep 2008 17:53:32 -0700

> >> In .emacs I have a few variables defined using:
> >> (custom-set-variables
> >>   '(var1 val1)
> >>   '(var2 val2)
> >>   '(var3 val3))
> >>
> >> How can I define those same variables in .emacs
> >> without using custom-set-variables?
> > 
> > Typically:
> > (setq var1 val1
> >       var2 val2
> >       var3 val3)
> > 
> > But see also `setq-default'; it might be more appropriate 
> > for some variables.
> > 
> > As an alternative to not using `custom-set-variables', 
> > consider having a separate custom file, the value of
> > variable `custom-file', and letting Customize
> > manage `custom-set-variables' there. That will keep 
> > Customize out of your init
> > file (~/.emacs). See the Emacs manual, node Saving Customizations.
> 
> I think that is much better since setq/setq-default actually does not
> work for all custom variables. (See `defcustom' for details.)

Yes. And before you replace `custom-set-variables' for any options, read at
least the doc strings for those options to see if they specify any special
considerations for customizing. And different libraries treat variables
differently, so it's also a good idea to read the library's doc or Commentary
section.

In sum, `custom-set-variables' is probably what you want, even if you might not
think so. If you use something else, inform yourself before making the change.





reply via email to

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