[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#67991: 30.0.50; boundp always returns nil in format-mode-line with l
From: |
Eli Zaretskii |
Subject: |
bug#67991: 30.0.50; boundp always returns nil in format-mode-line with let* after 0fde935 |
Date: |
Sun, 24 Dec 2023 09:45:41 +0200 |
> From: Gerd Möllmann <gerd.moellmann@gmail.com>
> Cc: Aaron Jensen <aaronjensen@gmail.com>, monnier@iro.umontreal.ca,
> 67991@debbugs.gnu.org
> Date: Sun, 24 Dec 2023 08:13:39 +0100
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > This one will return t:
> >
> > (format-mode-line
> > '(:eval (progn
> > (defvar some-var)
> > (let* ((some-var "some-value")
> > (_ (message "Bound: %S" (boundp 'some-var))))
> > (message "Var: %S, Bound: %S" some-var (boundp 'some-var))))))
> >
>
> Indeed. Looking at Fdefvar, one can see that a "(defvar foo)" does this
> when lexical-binding is t
>
> /* A simple (defvar foo) with lexical scoping does "nothing" except
> declare that var to be dynamically scoped *locally* (i.e. within
> the current file or let-block). */
>
> while it does nothing at all if lexical-binding is nil. Maybe defvar's
> doc string could give some hint to that. This sentence at least is not
> true for "(defvar SYMBOL)":
>
> The ‘defvar’ form also declares the variable as "special",
> so that it is always dynamically bound even if ‘lexical-binding’ is t.
Thanks, I hope I clarified the doc string now.