comparison lispref/edebug.texi @ 63526:80bd8eddac37

(Instrumenting): Eliminate duplicate link. (Specification List): Replace references to "below", referring to a later node, with one @ref to that node.
author Luc Teirlinck <teirllm@auburn.edu>
date Thu, 16 Jun 2005 20:30:12 +0000
parents 35fe0bb36962
children 99e9892a51d9
comparison
equal deleted inserted replaced
63525:da42b07587f1 63526:80bd8eddac37
201 @pindex cl-specs.el 201 @pindex cl-specs.el
202 Edebug knows how to instrument all the standard special forms, 202 Edebug knows how to instrument all the standard special forms,
203 @code{interactive} forms with an expression argument, anonymous lambda 203 @code{interactive} forms with an expression argument, anonymous lambda
204 expressions, and other defining forms. However, Edebug cannot determine 204 expressions, and other defining forms. However, Edebug cannot determine
205 on its own what a user-defined macro will do with the arguments of a 205 on its own what a user-defined macro will do with the arguments of a
206 macro call, so you must provide that information; see @ref{Edebug and 206 macro call, so you must provide that information using Edebug
207 Macros}, for details. 207 specifications; see @ref{Edebug and Macros}, for details.
208 208
209 When Edebug is about to instrument code for the first time in a 209 When Edebug is about to instrument code for the first time in a
210 session, it runs the hook @code{edebug-setup-hook}, then sets it to 210 session, it runs the hook @code{edebug-setup-hook}, then sets it to
211 @code{nil}. You can use this to load Edebug specifications 211 @code{nil}. You can use this to load Edebug specifications
212 (@pxref{Edebug and Macros}) associated with a package you are 212 associated with a package you are using, but only when you use Edebug.
213 using, but only when you use Edebug.
214 213
215 @findex eval-expression @r{(Edebug)} 214 @findex eval-expression @r{(Edebug)}
216 To remove instrumentation from a definition, simply re-evaluate its 215 To remove instrumentation from a definition, simply re-evaluate its
217 definition in a way that does not instrument. There are two ways of 216 definition in a way that does not instrument. There are two ways of
218 evaluating forms that never instrument them: from a file with 217 evaluating forms that never instrument them: from a file with
1183 plus some context-free grammar constructs: the matching of sublists with 1182 plus some context-free grammar constructs: the matching of sublists with
1184 balanced parentheses, recursive processing of forms, and recursion via 1183 balanced parentheses, recursive processing of forms, and recursion via
1185 indirect specifications. 1184 indirect specifications.
1186 1185
1187 Here's a table of the possible elements of a specification list, with 1186 Here's a table of the possible elements of a specification list, with
1188 their meanings: 1187 their meanings (see @ref{Specification Examples}, for the referenced
1188 examples):
1189 1189
1190 @table @code 1190 @table @code
1191 @item sexp 1191 @item sexp
1192 A single unevaluated Lisp object, which is not instrumented. 1192 A single unevaluated Lisp object, which is not instrumented.
1193 @c an "expression" is not necessarily intended for evaluation. 1193 @c an "expression" is not necessarily intended for evaluation.
1219 as one does not match, Edebug stops matching at this level. 1219 as one does not match, Edebug stops matching at this level.
1220 1220
1221 To make just a few elements optional followed by non-optional elements, 1221 To make just a few elements optional followed by non-optional elements,
1222 use @code{[&optional @var{specs}@dots{}]}. To specify that several 1222 use @code{[&optional @var{specs}@dots{}]}. To specify that several
1223 elements must all match or none, use @code{&optional 1223 elements must all match or none, use @code{&optional
1224 [@var{specs}@dots{}]}. See the @code{defun} example below. 1224 [@var{specs}@dots{}]}. See the @code{defun} example.
1225 1225
1226 @item &rest 1226 @item &rest
1227 @c @kindex &rest @r{(Edebug)} 1227 @c @kindex &rest @r{(Edebug)}
1228 All following elements in the specification list are repeated zero or 1228 All following elements in the specification list are repeated zero or
1229 more times. In the last repetition, however, it is not a problem if the 1229 more times. In the last repetition, however, it is not a problem if the
1260 a list specification. 1260 a list specification.
1261 1261
1262 @item nil 1262 @item nil
1263 This is successful when there are no more arguments to match at the 1263 This is successful when there are no more arguments to match at the
1264 current argument list level; otherwise it fails. See sublist 1264 current argument list level; otherwise it fails. See sublist
1265 specifications and the backquote example below. 1265 specifications and the backquote example.
1266 1266
1267 @item gate 1267 @item gate
1268 @cindex preventing backtracking 1268 @cindex preventing backtracking
1269 No argument is matched but backtracking through the gate is disabled 1269 No argument is matched but backtracking through the gate is disabled
1270 while matching the remainder of the specifications at this level. This 1270 while matching the remainder of the specifications at this level. This
1271 is primarily used to generate more specific syntax error messages. See 1271 is primarily used to generate more specific syntax error messages. See
1272 @ref{Backtracking}, for more details. Also see the @code{let} example 1272 @ref{Backtracking}, for more details. Also see the @code{let} example.
1273 below.
1274 1273
1275 @item @var{other-symbol} 1274 @item @var{other-symbol}
1276 @cindex indirect specifications 1275 @cindex indirect specifications
1277 Any other symbol in a specification list may be a predicate or an 1276 Any other symbol in a specification list may be a predicate or an
1278 indirect specification. 1277 indirect specification.
1279 1278
1280 If the symbol has an Edebug specification, this @dfn{indirect 1279 If the symbol has an Edebug specification, this @dfn{indirect
1281 specification} should be either a list specification that is used in 1280 specification} should be either a list specification that is used in
1282 place of the symbol, or a function that is called to process the 1281 place of the symbol, or a function that is called to process the
1283 arguments. The specification may be defined with @code{def-edebug-spec} 1282 arguments. The specification may be defined with @code{def-edebug-spec}
1284 just as for macros. See the @code{defun} example below. 1283 just as for macros. See the @code{defun} example.
1285 1284
1286 Otherwise, the symbol should be a predicate. The predicate is called 1285 Otherwise, the symbol should be a predicate. The predicate is called
1287 with the argument and the specification fails if the predicate returns 1286 with the argument and the specification fails if the predicate returns
1288 @code{nil}. In either case, that argument is not instrumented. 1287 @code{nil}. In either case, that argument is not instrumented.
1289 1288
1300 is equivalent to the quoted symbol, @code{'@var{symbol}}, where the name 1299 is equivalent to the quoted symbol, @code{'@var{symbol}}, where the name
1301 of @var{symbol} is the @var{string}, but the string form is preferred. 1300 of @var{symbol} is the @var{string}, but the string form is preferred.
1302 1301
1303 @item (vector @var{elements}@dots{}) 1302 @item (vector @var{elements}@dots{})
1304 The argument should be a vector whose elements must match the 1303 The argument should be a vector whose elements must match the
1305 @var{elements} in the specification. See the backquote example below. 1304 @var{elements} in the specification. See the backquote example.
1306 1305
1307 @item (@var{elements}@dots{}) 1306 @item (@var{elements}@dots{})
1308 Any other list is a @dfn{sublist specification} and the argument must be 1307 Any other list is a @dfn{sublist specification} and the argument must be
1309 a list whose elements match the specification @var{elements}. 1308 a list whose elements match the specification @var{elements}.
1310 1309
1313 argument may then be a dotted list. Alternatively, the last @sc{cdr} of a 1312 argument may then be a dotted list. Alternatively, the last @sc{cdr} of a
1314 dotted list specification may be another sublist specification (via a 1313 dotted list specification may be another sublist specification (via a
1315 grouping or an indirect specification, e.g., @code{(spec . [(more 1314 grouping or an indirect specification, e.g., @code{(spec . [(more
1316 specs@dots{})])}) whose elements match the non-dotted list arguments. 1315 specs@dots{})])}) whose elements match the non-dotted list arguments.
1317 This is useful in recursive specifications such as in the backquote 1316 This is useful in recursive specifications such as in the backquote
1318 example below. Also see the description of a @code{nil} specification 1317 example. Also see the description of a @code{nil} specification
1319 above for terminating such recursion. 1318 above for terminating such recursion.
1320 1319
1321 Note that a sublist specification written as @code{(specs . nil)} 1320 Note that a sublist specification written as @code{(specs . nil)}
1322 is equivalent to @code{(specs)}, and @code{(specs . 1321 is equivalent to @code{(specs)}, and @code{(specs .
1323 (sublist-elements@dots{}))} is equivalent to @code{(specs 1322 (sublist-elements@dots{}))} is equivalent to @code{(specs
1325 @end table 1324 @end table
1326 1325
1327 @c Need to document extensions with &symbol and :symbol 1326 @c Need to document extensions with &symbol and :symbol
1328 1327
1329 Here is a list of additional specifications that may appear only after 1328 Here is a list of additional specifications that may appear only after
1330 @code{&define}. See the @code{defun} example below. 1329 @code{&define}. See the @code{defun} example.
1331 1330
1332 @table @code 1331 @table @code
1333 @item name 1332 @item name
1334 The argument, a symbol, is the name of the defining form. 1333 The argument, a symbol, is the name of the defining form.
1335 1334
1362 @item def-form 1361 @item def-form
1363 The argument is a single, highest-level form in a definition. This is 1362 The argument is a single, highest-level form in a definition. This is
1364 like @code{def-body}, except use this to match a single form rather than 1363 like @code{def-body}, except use this to match a single form rather than
1365 a list of forms. As a special case, @code{def-form} also means that 1364 a list of forms. As a special case, @code{def-form} also means that
1366 tracing information is not output when the form is executed. See the 1365 tracing information is not output when the form is executed. See the
1367 @code{interactive} example below. 1366 @code{interactive} example.
1368 @end table 1367 @end table
1369 1368
1370 @node Backtracking 1369 @node Backtracking
1371 @subsubsection Backtracking in Specifications 1370 @subsubsection Backtracking in Specifications
1372 1371