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: Tim X
Subject: Re: Replacing custom-set-variables
Date: Sun, 14 Sep 2008 14:33:07 +1000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Giorgos Keramidas <keramida@ceid.upatras.gr> writes:

> On Sat, 13 Sep 2008 14:19:52 -0300, Mauricio <briqueabraque@yahoo.com> wrote:
>> Hi,
>>
>> 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?
>
> You can always use `setq-default', either in one call:
>
>     (setq-default var1 val1
>                   var2 val2
>                   var3 val3)
>
> or multiple calls:
>
>     (setq-default var1 val1)
>     (setq-default var2 val2)
>     (setq-default var3 val3)
>

Be careful using setq-default in .emacs. The difference between setq and
setq-default is that if the variable is already bound to a value,
setq-default does nothing. This can cause confusion/problems when you
are working/tweaking your .emacs and you want to re-evaluate things. If
you have your .emacs split into multiple files to make it easier to
manage, it can be even more confusioing as you may have the same value
being set somewhere else and you start ripping out your hair tyring to
work out why your changes are not taking effect. 

This is not to say that setq-default should not be used. To a large
extent its a matter of taste/style. I just wanted to emphasise the
differences between the two. 

Tim


-- 
tcross (at) rapttech dot com dot au


reply via email to

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