A specification list is required for an Edebug specification if
some arguments of a macro call are evaluated while others are not. Some
elements in a specification list match one or more arguments, but others
modify the processing of all following elements. The latter, called
keyword specifications, are symbols beginning with ‘&’
(e.g. &optional).
A specification list may contain sublists which match arguments that are themselves lists, or it may contain vectors used for grouping. Sublists and groups thus subdivide the specification list into a hierarchy of levels. Keyword specifications only apply to the remainder of the sublist or group they are contained in and there is an implicit grouping around a keyword specification and all following elements in the sublist or group.
If a specification list fails at some level, then backtracking may be invoked to find some alternative at a higher level, or if no alternatives remain, an error will be signaled. See Backtracking for more details.
Edebug specifications provide at least the power of regular expression matching. Some context-free constructs are also supported: the matching of sublists with balanced parentheses, recursive processing of forms, and recursion via indirect specifications.
Each element of a specification list may be one of the following, with the corresponding type of argument:
sexpformplacesetf place argument. It will be
instrumented just like a form, but the macro is expected to strip the
instrumentation. Two functions, edebug-unwrap and
edebug-unwrap*, are provided to strip the instrumentation one
level or recursively at all levels.
body&rest form. See &rest below.
function-formquote rather than function since the body of a lambda
expression will be instrumented either way.
lambda-expr&optionalTo make just a few elements optional followed by non-optional elements,
use [&optional specs...]. To specify that several
elements should all succeed together, use &optional
[specs...]. See the defun example below.
&restTo repeat only a few elements, use [&rest specs...].
To specify all elements must match on every repetition, use &rest
[specs...].
&or&or specification fails.
Each list element following &or is a single alternative even if
it is a keyword specification. (This breaks the implicit grouping rule.)
To group two or more list elements as a single alternative, enclose them
in [...].
¬&or, but if any of them match, the specification fails. If none
of them match, nothing is matched, but the ¬ specification
succeeds.
&define&define keyword should be the first element in
a list specification.
Additional specifications that may only appear after &define are
described here. See the defun example below.
nameThe name specification may be used more than once in the
specification and each subsequent use will append the corresponding
symbol argument to the previous name with ‘@’ between them.
This is useful for generating unique but meaningful names for
definitions such as defadvice and defmethod.
:name:name should be a symbol; it is used as an
additional name component for the definition. This is useful to add a
unique, static component to the name of the definition. It may be used
more than once. No argument is matched.
arg&’)
are not allowed. See lambda-list and the example below.
lambda-list&optional and &rest
def-bodybody, described above, but a definition body must be instrumented
with a different Edebug call that looks up information associated with
the definition. Use def-body for the highest level list of forms
within the definition.
def-formdef-body, except use this to match a single form rather than
a list of forms. As a special case, def-form also means that
tracing information is not output when the form is executed. See the
interactive example below.
nilgatelet example
below.
If the symbol has an Edebug specification, this indirect
specification should be either a list specification that is used in
place of the symbol, or a function that is called to process the
arguments. The specification may be defined with def-edebug-spec
just as for macros. See the defun example below.
Otherwise, the symbol should be a predicate. The predicate is called with the argument and the specification fails if the predicate fails. The argument is not instrumented.
Predicates that may be used include: symbolp, integerp,
stringp, vectorp, atom (which matches a number,
string, symbol, or vector), keywordp, and
lambda-list-keywordp. The last two, defined in edebug.el,
test whether the argument is a symbol starting with ‘:’ and
‘&’ respectively.
[elements...]"string"'symbol, where the name
of symbol is the string, but the string form is preferred.
'symbol or (quote symbol)(vector elements...)(elements...)A sublist specification may be a dotted list and the corresponding list
argument may then be a dotted list. Alternatively, the last cdr of a
dotted list specification may be another sublist specification (via a
grouping or an indirect specification, e.g. (spec . [(more
specs...)])) whose elements match the non-dotted list arguments.
This is useful in recursive specifications such as in the backquote
example below. Also see the description of a nil specification
above for terminating such recursion.
Note that a sublist specification of the form (specs . nil)
means the same as (specs), and (specs .
(sublist-elements...)) means the same as (specs
sublist-elements...).