Setting a variable means to overwrite its current value (that is, the value of its most recent binding) with a new one. The old value is irretrievably lost (unlike when a new value is bound to a variable, see section Local Variables).
setq is the usual method of altering the value of
a variable. Each variable is set to the result of evaluating its
corresponding form. The last value assigned becomes the value of
the setq form.
(setq x 20 y (+ 2 3))
=> 5
In the above example the variable x is set to 20 and y
is set to the value of the form (+ 2 3) (5).
When the variable is marked as being buffer-local (see section Buffer-Local Variables) the current buffer's instance of the variable is set.
This function is used when the variable is unknown until run-time, and therefore has to be computed from a form.
(set 'foo 20)
==
(setq foo 20) ;setq means `set-quoted'
=> 20
Go to the first, previous, next, last section, table of contents.