11.9.1 Dynamic Binding

By default, the local variable bindings made by Emacs are dynamic
bindings. When a variable is dynamically bound, its current binding
at any point in the execution of the Lisp program is simply the most
recently-created dynamic local binding for that symbol, or the global
binding if there is no such local binding.

Dynamic bindings have dynamic scope and extent, as shown by the
following example:

The function getx refers to x. This is a “free”
reference, in the sense that there is no binding for x within
that defun construct itself. When we call getx from
within a let form in which x is (dynamically) bound, it
retrieves the local value (i.e., 1). But when we call getx
outside the let form, it retrieves the global value (i.e.,
−99).

Here is another example, which illustrates setting a dynamically
bound variable using setq:

Dynamic binding is implemented in Emacs Lisp in a simple way. Each
symbol has a value cell, which specifies its current dynamic value (or
absence of value). See Symbol Components. When a symbol is given
a dynamic local binding, Emacs records the contents of the value cell
(or absence thereof) in a stack, and stores the new local value in the
value cell. When the binding construct finishes executing, Emacs pops
the old value off the stack, and puts it in the value cell.