Here's a simple example from the manual:

;; Here the symbol ‘abracadabra’
;;   is the symbol whose value is examined.
(let ((abracadabra 'foo))
  (symbol-value 'abracadabra))
⇒ foo

Why does this throw an error with lexical binding? The variable is bound in the let, isn't it?

Emacs 26.2

  • Which is to say (and unlike dynamic variables), lexical values are not stored in the value slot of the associated symbol.
    – phils
    Jul 12, 2020 at 20:10
  • Yes, thanks. The manual also describes this, but in a way that skimming over it I thought if the variable has no lexical value then it falls back to the dynamically bound value.
    – Tom
    Jul 12, 2020 at 20:11


Browse other questions tagged or ask your own question.