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

From: Ignacio Casso <[email-masked]>
Date: Tue, 12 Apr 2022 14:16:34 +0200

> Please tell more in each case where you consider the behavior
> "surprising" why did you expect something different.  I think it's
> important to make the subsequent discussion focused and efficient.
>
> Thanks.

I explained why I considered some of those cases surprising by
themselves in previous emails of the thread. I originally expected
`default-value', `set-default' and `default-boundp' to behave like their
counterparts `default-toplevel-value' and
`set-default-toplevel-value'. But I assumed there was a reason for there
being two versions, so I was just going to update some docstrings to
make the distinction more clear (or in the case `default-boundp',
correct the docstring, which is just wrong).

But now, considering all the cases together, I also consider surprising
that the behavior, whichever the correct one should be, depends on
whether the variable has or not a buffer local binding. So for example,
for the following

> ;; 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. And the same goes for
every two pair of snippets that only differ in whether the form
(setq-local varX "buffer-local") is present. So I was no longer sure
that the issue was just incomplete or ambiguous documentation, and I
wrote all the cases I could think in the last email to see what you
think about it.

P.S. By the way, I had deleted the previous emails on these thread, so I
could not properly reply to the last one, and had to just write to
[email-masked] instead. What is the proper way to reply to an
debbugs email thread that is no longer or never was in your inbox? For
the org-mode mail list there is a link on the web archives, but not for
debbugs.gnu.org. Is there a quick way from the debbugs package? Or maybe
using some of the info in the mbox file, which can be downloaded from
the archives in debbugs.gnu.org? Thanks