Next: , Previous: , Up: Edebug   [Contents][Index]


22.4.16 Instrumenting Macro Calls

When Edebug instruments an expression that calls a Lisp macro, it needs additional advice to do the job properly. This is because there is no way to tell which subexpressions of the macro call may be evaluated. Evaluation may occur explicitly in the macro body, or when the resulting expansion is evaluated, or any time later. You must explain the format of macro call arguments by using def-edebug-spec to define an Edebug specification for each macro.

Macro: def-edebug-spec macro specification

Specify which expressions of a call to macro macro are forms to be evaluated. For simple macros, the specification often looks very similar to the formal argument list of the macro definition, but specifications are much more general than macro arguments.

The macro argument may actually be any symbol, not just a macro name.

Unless you are using SXEmacs, Emacs 19+ or XEmacs, this macro is only defined in Edebug, so you may want to use the following which is equivalent: (put 'macro 'edebug-form-spec 'specification)

Here is a simple example that defines the specification for the for macro described in the SXEmacs Lisp Reference Manual, followed by an alternative, equivalent specification.

(def-edebug-spec for
  (symbolp "from" form "to" form "do" &rest form))

(def-edebug-spec for
  (symbolp ['from form] ['to form] ['do body]))

Here is a table of the possibilities for specification and how each directs processing of arguments.


Next: , Previous: , Up: Edebug   [Contents][Index]