Subject: Re: bug#54399: 27.2; Problems with (let ((custom-variable ...)) (autoload-function ...))

From: Stefan Monnier <[email-masked]>
Date: Tue, 12 Apr 2022 11:04:49 -0400

>>>> ;; default defined, buffer-local undefined
>>>> (defvar var1 "default")
>>>> (let ((var1 "inside let")) (default-value 'var1)) ;; returns "inside let"
>>>> 
>>>> ;; default defined, buffer-local defined
>>>> (defvar var2 "default")
>>>> (setq-local var2 "buffer-local")
>>>> (let ((var2 "inside let")) (default-value 'var2)) ;; returns "default"
>>>
>>> I would expect both snippets to return the same.
>>
>> That's because you expect the "default" in `default-value` refers to the
>> let-nesting dimension rather than the buffer dimension.
>
> No, I just expect to refer to any of those consistently, I don't mind
> which one. If it's the buffer dimension, even inside let bindings, both
> forms should return "default".

If there's no buffer-local value and `default-value` operates in the
buffer-local dimension, why do you expect it to return a different value
from `symbol-value`?

        Stefan