emacs-devel
[Top][All Lists]
Advanced

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

Question reg. docstring of symbol-value


From: Arash Esbati
Subject: Question reg. docstring of symbol-value
Date: Tue, 02 Nov 2021 21:52:41 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50

Hi all,

me and my fellow AUCTeX maintainers stumbled over the docstring of
`symbol-value' which says:

,----[ C-h f symbol-value RET ]
| symbol-value is a built-in function in ‘C source code’.
| 
| (symbol-value SYMBOL)
| 
| Return SYMBOL’s value.  Error if that is void.
| Note that if ‘lexical-binding’ is in effect, this returns the
| global value outside of any lexical scope.
`----

How does the last sentence fit to these two examples (eval'ed in
*scratch*):

--8<---------------cut here---------------start------------->8---
(defvar foo 1)
(let ((foo foo))
  (setq foo (1+ foo))
  (symbol-value 'foo))
;; => 2


(setq bar 1)
(let ((bar bar))
  (setq bar (1+ bar))
  (symbol-value 'bar))
;; => 1
--8<---------------cut here---------------end--------------->8---

Is the intention to say "..., this returns the global value outside of
any lexical scope for symbols not marked as special" or something like
that?  Or am I missing something?

Best, Arash



reply via email to

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