GNU bug report logs -
#67991
30.0.50; boundp always returns nil in format-mode-line with let* after 0fde935
Previous Next
Full log
View this message in rfc822 format
> From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
> Cc: Aaron Jensen <aaronjensen <at> gmail.com>, monnier <at> iro.umontreal.ca,
> 67991 <at> debbugs.gnu.org
> Date: Sun, 24 Dec 2023 08:13:39 +0100
>
> Eli Zaretskii <eliz <at> 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.
This bug report was last modified 1 year and 175 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.