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: Mon, 19 Apr 2021 08:40:30 +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:

> Emanuel Berg via Users list for the GNU Emacs text editor wrote:
>
>>>>    my-var
>>>> ;; => foo
>>>
>>> And now it isn't anymore so the default is there, great.
>>
>> No, why isn't that 7? argh!

It was a contrived example, sorry.  It is 7 because inside the
(with-current-buffer ...) I did a (setq-default my-var 'foo), and that
affected the global value.

>> I must write my own version :)
>
> OK, so after you say it is local with `make-local-variable' it
> doesn't matter you do `setq', it won't get global that way?

True

> No, but that's consistent actually, you can setq other local
> stuff tho I prefer `let' and do all computation before any of
> it is used, but you can, that's right.
>
> setq isn't (always) global unless you make a typo...

:)

Two more points:

 - re space vs tabs: I didn't want to make an argument on that, I was
   only saying that for some buffer you *may* prefer to have tabs and in
   other plain spaces, but that it's up to the user, buffer-local
   variables are  away to implement such behaviour.  The example of the
   chat was indeed better
 - re "pecking order": I would only think of local and global var, with
   the twist that the latter comes in two flavors ("real" global var and
   buffer-local version.)  It kinda gets more complex than that when you
   throw into the mix file and directory-local variable and dynamic
   scoping tho :P  (I admit I never thought about the full implication
   of all those types of variables)



reply via email to

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