I am wondering the semantic of the error function. For condition-case, the Elisp manual says:

The arguments after the protected form are handlers. Each handler lists one or more condition names (which are symbols) to specify which errors it will handle.

From its example:

(condition-case nil
    (delete-file filename)
  (error nil))

The error in (error nil) is the condition which is a symbol in my understanding.

On the other hand, when we want to raise an error, we use the function error as well. From the Elisp manual:

Function: error format-string &rest args

This function signals an error with an error message constructed by applying format-message (see Formatting Strings) to format-string and args.

and example:

(error "That is an error -- try something else")

The error function will create a message and signal the error. What I cannot understand is, what is the difference between this error signaling function, and the error symbol in the (condition-case) above? If (error) is a function used to signal an error, in the (condition-case) above the (error nil) should be eval-ed and raise an error with a nil message instead of catching an error?

1 Answer 1


The docstring for condition-case (C-h f condition-case) says:

condition-case is a special form in `C source code'.

(condition-case VAR BODYFORM &rest HANDLERS)

Regain control when an error is signaled. Executes BODYFORM and returns its value if no error happens. Each element of HANDLERS looks like (CONDITION-NAME BODY...) where the BODY is made of Lisp expressions.

The elisp manual describes "special form" as (emphasis mine):

A “special form” is a primitive function specially marked so that its arguments are not all evaluated. Most special forms define control structures or perform variable bindings—things which functions cannot do.

Each special form has its own rules for which arguments are evaluated and which are used without evaluation. Whether a particular argument is evaluated may depend on the results of evaluating other arguments.

So in this case, the condition name error is not evaluated but simply used as a symbol; if it matches the raised error, the corresponding body is evaluated.

Contrary to many programming languages, a symbol is just that, a symbol, although it very often references another object, such as a variable or function. You may want to have a look at the section on symbols in the elisp manual to further clarify this.

  • Thank you very much. I should pay attention to the "special form".
    – Jason Umi
    Nov 1, 2016 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.