1.7.2 Error Message for a Symbol Without a Value

If you attempt to evaluate a symbol that does not have a value bound to it, you will receive an error message. You can see this by experimenting with our 2 plus 2 addition. In the following expression, put your cursor right after the +, before the first number 2, type C-x C-e:

(+ 2 2)

In GNU Emacs 22, you will create a *Backtrace* buffer that says:

---------- Buffer: *Backtrace* ----------
Debugger entered--Lisp error: (void-variable +)
  eval(+)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)
---------- Buffer: *Backtrace* ----------

(Again, you can quit the debugger by typing q in the *Backtrace* buffer.)

This backtrace is different from the very first error message we saw, which said, ‘Debugger entered--Lisp error: (void-function this)’. In this case, the function does not have a value as a variable; while in the other error message, the function (the word ‘this’) did not have a definition.

In this experiment with the +, what we did was cause the Lisp interpreter to evaluate the + and look for the value of the variable instead of the function definition. We did this by placing the cursor right after the symbol rather than after the parenthesis of the enclosing list as we did before. As a consequence, the Lisp interpreter evaluated the preceding s-expression, which in this case was + by itself.

Since + does not have a value bound to it, just the function definition, the error message reported that the symbol’s value as a variable was void.