GNU bug report logs - #67991
30.0.50; boundp always returns nil in format-mode-line with let* after 0fde935

Previous Next

Package: emacs;

Reported by: Aaron Jensen <aaronjensen <at> gmail.com>

Date: Sat, 23 Dec 2023 14:53:02 UTC

Severity: normal

Found in version 30.0.50

Full log


View this message in rfc822 format

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: monnier <at> iro.umontreal.ca, Aaron Jensen <aaronjensen <at> gmail.com>, 67991 <at> debbugs.gnu.org
Subject: bug#67991: 30.0.50; boundp always returns nil in format-mode-line with let* after 0fde935
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.




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.