Subject: Re: bug#66117: 30.0.50; `find-buffer-visiting' is slow when opening large number of buffers

From: Ihor Radchenko <[email-masked]>
Date: Tue, 02 Jan 2024 10:52:50 +0000

Gerd Möllmann <[email-masked]> writes:

>>>>> C-h f default-value explains this:
>>>>>
>>>>>   Return SYMBOL’s default value.
>>>>>   This is the value that is seen in buffers that do not have their own values
>>>>>   for this variable.
>>>>
>> ...
>> I am sorry, but I do not see how the docstring explains what is
>> happening there. Because it is not clear what `let' does with the
>> default value.
>
> Sorry for not being clear. What I wanted to hint at is the part of the
> doc string that reads "that do not have their own values...", which
> means that what default-value returns depends whether or not SYMBOL got
> its own value in the buffer, and that depends on the presence of lets,
> and so on.

It is not how I read this. AFAIU, `default-value' returns the value that
is used for buffers where the value is not explicitly set. Calling
`default-value' from inside the buffer where the value is set does not
change that global default value and should not change what
`default-value' returns.

And indeed

(defvar-local yant/test 'default-value)
(with-temp-buffer
  (setq yant/test 'local-value)
  (default-value 'yant/test)) ; => 'default-value

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>