[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: setq and setq-default
From: |
jronald |
Subject: |
Re: setq and setq-default |
Date: |
Thu, 14 Sep 2006 02:26:12 +0800 |
I think setq-default set a global variable, and setq set a variable in its
scope, which may override the global one.
If so, can setq set a global variable when it is in the global scope.
If tab-width and default-tab-width both exsists, what is the priority emacs
treats them?
<robert.thorpe@antenova.com>
??????:1158164996.335560.182180@i3g2000cwc.googlegroups.com...
> jronald wrote:
>> I studied them for a while, but without details and examples.
>>
>> For example, what is the difference of the two below:
>> (setq-default tab-width 8)
>
> This is the general way to set the default value of a variable. If you
> put (setq-default foo 9) then in the context of every buffer you create
> foo will be 9 unless the buffer has it's own value for that variable.
>
>> (setq default-tab-width 8)
>
> This means the same thing, except it is a mechanism specific to
> tab-width, not all variables have a special "default" form associated
> with them. Only a handful have them, I don't know why, perhaps
> setq-default didn't exist in very early Emacs.
>