bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#34234: 27.0.50; local defvar and special-variable-p


From: Lars Ingebrigtsen
Subject: bug#34234: 27.0.50; local defvar and special-variable-p
Date: Tue, 09 Jul 2019 20:08:16 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Sebastian Miele <address@hidden> writes:

> ;; Run ./src/emacs -Q, put this into *scratch*, and C-x C-e through
> ;; what follows outside of comments.
> ;;
> (setq lexical-binding t)
> ;;
> ;; The expression
> ;;
> (progn
>   (defvar x)
>   (special-variable-p 'x))
> ;;
> ;; evaluates to nil. But in fact x is special in that context, as
> ;; described in the Elisp manual, and as witnessed by e.g.
> ;;
> (funcall (progn
>            (setq x 0)
>            (defvar x)
>            (let ((x 1)) (lambda () x))))
> ;;
> ;; evaluating to 0.

But the doc string says:

---
special-variable-p is a built-in function in ‘src/eval.c’.

(special-variable-p SYMBOL)

  Probably introduced at or before Emacs version 24.1.

Return non-nil if SYMBOL’s global binding has been declared special.
A special variable is one that will be bound dynamically, even in a
context where binding is lexical by default.
---

Note "global binding".  So it doesn't say whether x is special in that
context, but whether it's special globally, so I think the function
works as documented.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

[Prev in Thread] Current Thread [Next in Thread]