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

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

Re: don't understand setq-default


From: Omar Polo
Subject: Re: don't understand setq-default
Date: Sun, 18 Apr 2021 15:02:26 +0200
User-agent: mu4e 1.4.15; emacs 28.0.50

Emanuel Berg via Users list for the GNU Emacs text editor 
<help-gnu-emacs@gnu.org> writes:

> I don't understand `setq-default', maybe I never did, unsure.
>
> The docstring isn't good, it only describes how it will
> happens which is intuitive at that (well, that's good that
> it) but not how and why it is used.
>
> [...]

buffer can have local version of some variables.  In addition, some
variables automatically becomes buffer-local when set (like
`indent-tabs-mode' for instance.)

The docstring seems pretty clear to me:

> [...]
>
> (setq-default [VAR VALUE]...)
>
>   Probably introduced at or before Emacs version 18.
>
> Set the default value of variable VAR to VALUE.
> VAR, the variable name, is literal (not evaluated);
> VALUE is an expression: it is evaluated and its value returned.
> **The default value of a variable is seen in buffers
> that do not have their own values for the variable.**

(emphasis mine)

So the question becomes: "when can a buffer have a non-default value for a
variable?"

(info "(elisp) Buffer-Local Variables") should have more information on
the matter

> [...]



reply via email to

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