* etags.c (readline): expect sscanf returns >= 1.
[bpt/emacs.git] / lispref / edebug.texi
index c93330e..b2bab60 100644 (file)
@@ -1,15 +1,16 @@
 @comment -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1992, 1993, 1994, 1998 Free Software Foundation, Inc. 
+@c Copyright (C) 1992, 1993, 1994, 1998, 1999, 2002, 2003, 2004,
+@c   2005, 2006 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 
-@c This file can also be used by an independent Edebug User 
-@c Manual in which case the Edebug node below should be used 
+@c This file can also be used by an independent Edebug User
+@c Manual in which case the Edebug node below should be used
 @c with the following links to the Bugs section and to the top level:
 
 @c , Bugs and Todo List, Top, Top
 
-@node Edebug,, Compilation Errors, Debugging
+@node Edebug, Syntax Errors, Debugger, Debugging
 @section Edebug
 @cindex Edebug mode
 
@@ -35,7 +36,7 @@ at each breakpoint.
 Display expression results and evaluate expressions as if outside of
 Edebug.
 
-@item 
+@item
 Automatically re-evaluate a list of expressions and
 display their results each time Edebug updates the display.
 
@@ -65,17 +66,17 @@ enable you to use it.
 * Modes: Edebug Execution Modes. Execution modes, stopping more or less often.
 * Jumping::                    Commands to jump to a specified place.
 * Misc: Edebug Misc.           Miscellaneous commands.
-* Breakpoints::                        Setting breakpoints to make the program stop.
-* Trapping Errors::            trapping errors with Edebug.
+* Breaks::                      Setting breakpoints to make the program stop.
+* Trapping Errors::            Trapping errors with Edebug.
 * Views: Edebug Views.         Views inside and outside of Edebug.
-* Eval: Edebug Eval.                   Evaluating expressions within Edebug.
+* Eval: Edebug Eval.           Evaluating expressions within Edebug.
 * Eval List::                  Expressions whose values are displayed
                                  each time you enter Edebug.
 * Printing in Edebug::         Customization of printing.
 * Trace Buffer::               How to produce trace output in a buffer.
 * Coverage Testing::           How to test evaluation coverage.
 * The Outside Context::                Data that Edebug saves and restores.
-* Instrumenting Macro Calls::  Specifying how to handle macro calls.
+* Edebug and Macros::          Specifying how to handle macro calls.
 * Options: Edebug Options.     Option variables for customizing Edebug.
 @end menu
 
@@ -89,23 +90,23 @@ first move point into the definition of a function or macro and then do
 @ref{Instrumenting}, for alternative ways to instrument code.
 
   Once a function is instrumented, any call to the function activates
-Edebug.  Activating Edebug may stop execution and let you step through
-the function, or it may update the display and continue execution while
-checking for debugging commands, depending on which Edebug execution
-mode you have selected.  The default execution mode is step, which does
-stop execution.  @xref{Edebug Execution Modes}.
+Edebug.  Depending on which Edebug execution mode you have selected,
+activating Edebug may stop execution and let you step through the
+function, or it may update the display and continue execution while
+checking for debugging commands.  The default execution mode is step,
+which stops execution.  @xref{Edebug Execution Modes}.
 
   Within Edebug, you normally view an Emacs buffer showing the source of
 the Lisp code you are debugging.  This is referred to as the @dfn{source
-code buffer}.  This buffer is temporarily read-only.
+code buffer}, and it is temporarily read-only.
 
-  An arrow at the left margin indicates the line where the function is
+  An arrow in the left fringe indicates the line where the function is
 executing.  Point initially shows where within the line the function is
 executing, but this ceases to be true if you move point yourself.
 
   If you instrument the definition of @code{fac} (shown below) and then
-execute @code{(fac 3)}, here is what you normally see.  Point is at the
-open-parenthesis before @code{if}.
+execute @code{(fac 3)}, here is what you would normally see.  Point is
+at the open-parenthesis before @code{if}.
 
 @example
 (defun fac (n)
@@ -117,14 +118,14 @@ open-parenthesis before @code{if}.
 @cindex stop points
 The places within a function where Edebug can stop execution are called
 @dfn{stop points}.  These occur both before and after each subexpression
-that is a list, and also after each variable reference.  
-Here we show with periods the stop points found in the function
+that is a list, and also after each variable reference.
+Here we use periods to show the stop points in the function
 @code{fac}:
 
 @example
 (defun fac (n)
   .(if .(< 0 n.).
-      .(* n. .(fac (1- n.).).).
+      .(* n. .(fac .(1- n.).).).
     1).)
 @end example
 
@@ -142,7 +143,7 @@ display you will see:
 @end example
 
 When Edebug stops execution after an expression, it displays the
-expression's value in the echo area. 
+expression's value in the echo area.
 
 Other frequently used commands are @kbd{b} to set a breakpoint at a stop
 point, @kbd{g} to execute until a breakpoint is reached, and @kbd{q} to
@@ -158,18 +159,18 @@ into it, to invoke Edebug at the proper places.
 
 @kindex C-M-x
 @findex eval-defun (Edebug)
-  Once you have loaded Edebug, the command @kbd{C-M-x}
-(@code{eval-defun}) is redefined so that when invoked with a prefix
-argument on a definition, it instruments the definition before
-evaluating it.  (The source code itself is not modified.)  If the
-variable @code{edebug-all-defs} is non-@code{nil}, that inverts the
-meaning of the prefix argument: then @kbd{C-M-x} instruments the
-definition @emph{unless} it has a prefix argument.  The default value of
-@code{edebug-all-defs} is @code{nil}.  The command @kbd{M-x
-edebug-all-defs} toggles the value of the variable
-@code{edebug-all-defs}.
+  When you invoke command @kbd{C-M-x} (@code{eval-defun}) with a
+prefix argument on a function definition, it instruments the
+definition before evaluating it.  (This does not modify the source
+code itself.)  If the variable @code{edebug-all-defs} is
+non-@code{nil}, that inverts the meaning of the prefix argument: in
+this case, @kbd{C-M-x} instruments the definition @emph{unless} it has
+a prefix argument.  The default value of @code{edebug-all-defs} is
+@code{nil}.  The command @kbd{M-x edebug-all-defs} toggles the value
+of the variable @code{edebug-all-defs}.
 
 @findex eval-region @r{(Edebug)}
+@findex eval-buffer @r{(Edebug)}
 @findex eval-current-buffer @r{(Edebug)}
   If @code{edebug-all-defs} is non-@code{nil}, then the commands
 @code{eval-region}, @code{eval-current-buffer}, and @code{eval-buffer}
@@ -188,10 +189,11 @@ instrument any top-level form regardless of the values of
 (@code{edebug-instrument-callee}) instruments the definition of the
 function or macro called by the list form after point, if is not already
 instrumented.  This is possible only if Edebug knows where to find the
-source for that function; after loading Edebug, @code{eval-region}
-records the position of every definition it evaluates, even if not
-instrumenting it.  See also the @kbd{i} command (@pxref{Jumping}), which
-steps into the call after instrumenting the function.
+source for that function; for this reading, after loading Edebug,
+@code{eval-region} records the position of every definition it
+evaluates, even if not instrumenting it.  See also the @kbd{i} command
+(@pxref{Jumping}), which steps into the call after instrumenting the
+function.
 
 @cindex special forms (Edebug)
 @cindex interactive commands (Edebug)
@@ -201,15 +203,15 @@ steps into the call after instrumenting the function.
 @pindex cl-specs.el
   Edebug knows how to instrument all the standard special forms,
 @code{interactive} forms with an expression argument, anonymous lambda
-expressions, and other defining forms.  Edebug cannot know what a
-user-defined macro will do with the arguments of a macro call, so you
-must tell it; see @ref{Instrumenting Macro Calls}, for details.
+expressions, and other defining forms.  However, Edebug cannot determine
+on its own what a user-defined macro will do with the arguments of a
+macro call, so you must provide that information using Edebug
+specifications; see @ref{Edebug and Macros}, for details.
 
   When Edebug is about to instrument code for the first time in a
 session, it runs the hook @code{edebug-setup-hook}, then sets it to
-@code{nil}.  You can use this to arrange to load Edebug specifications
-(@pxref{Instrumenting Macro Calls}) associated with a package you are
-using, but actually load them only if you use Edebug.
+@code{nil}.  You can use this to load Edebug specifications
+associated with a package you are using, but only when you use Edebug.
 
 @findex eval-expression @r{(Edebug)}
   To remove instrumentation from a definition, simply re-evaluate its
@@ -238,12 +240,12 @@ before it stops.
 
 Normally, you specify the Edebug execution mode by typing a command to
 continue the program in a certain mode.  Here is a table of these
-commands.  All except for @kbd{S} resume execution of the program, at
+commands; all except for @kbd{S} resume execution of the program, at
 least for a certain distance.
 
 @table @kbd
 @item S
-Stop: don't execute any more of the program for now, just wait for more
+Stop: don't execute any more of the program, but wait for more
 Edebug commands (@code{edebug-stop}).
 
 @item @key{SPC}
@@ -252,10 +254,11 @@ Step: stop at the next stop point encountered (@code{edebug-step-mode}).
 @item n
 Next: stop at the next stop point encountered after an expression
 (@code{edebug-next-mode}).  Also see @code{edebug-forward-sexp} in
-@ref{Edebug Misc}.
+@ref{Jumping}.
 
 @item t
-Trace: pause one second at each Edebug stop point (@code{edebug-trace-mode}).
+Trace: pause (normally one second) at each Edebug stop point
+(@code{edebug-trace-mode}).
 
 @item T
 Rapid trace: update the display at each stop point, but don't actually
@@ -296,15 +299,20 @@ Keyboard macros containing the commands in this section do not
 completely work: exiting from Edebug, to resume the program, loses track
 of the keyboard macro.  This is not easy to fix.  Also, defining or
 executing a keyboard macro outside of Edebug does not affect commands
-inside Edebug.  This is usually an advantage.  But see the
+inside Edebug.  This is usually an advantage.  See also the
 @code{edebug-continue-kbd-macro} option (@pxref{Edebug Options}).
 
-When you enter a new Edebug level, the initial execution mode comes from
-the value of the variable @code{edebug-initial-mode}.  By default, this
-specifies step mode.  Note that you may reenter the same Edebug level
-several times if, for example, an instrumented function is called
-several times from one command.
+When you enter a new Edebug level, the initial execution mode comes
+from the value of the variable @code{edebug-initial-mode}.
+(@xref{Edebug Options}.)  By default, this specifies step mode.  Note
+that you may reenter the same Edebug level several times if, for
+example, an instrumented function is called several times from one
+command.
 
+@defopt edebug-sit-for-seconds
+This option specifies how many seconds to wait between execution steps
+in trace mode.  The default is 1 second.
+@end defopt
 
 @node Jumping
 @subsection Jumping
@@ -316,15 +324,15 @@ breakpoint reached before the intended stop point will also stop
 execution.  @xref{Breakpoints}, for the details on breakpoints.
 
   These commands may fail to work as expected in case of nonlocal exit,
-because a nonlocal exit can bypass the temporary breakpoint where you
-expected the program to stop.
+as that can bypass the temporary breakpoint where you expected the
+program to stop.
 
 @table @kbd
 @item h
 Proceed to the stop point near where point is (@code{edebug-goto-here}).
 
 @item f
-Run the program forward over one expression
+Run the program for one expression
 (@code{edebug-forward-sexp}).
 
 @item o
@@ -334,9 +342,8 @@ Run the program until the end of the containing sexp.
 Step into the function or macro called by the form after point.
 @end table
 
-The @kbd{h} command proceeds to the stop point near the current location
-of point, using a temporary breakpoint.  See @ref{Breakpoints}, for more
-information about breakpoints.
+The @kbd{h} command proceeds to the stop point at or after the current
+location of point, using a temporary breakpoint.
 
 The @kbd{f} command runs the program forward over one expression.  More
 precisely, it sets a temporary breakpoint at the position that
@@ -348,13 +355,13 @@ With a prefix argument @var{n}, the temporary breakpoint is placed
 more elements, then the place to stop is after the containing
 expression.
 
-Be careful that the position @kbd{C-M-f} finds is a place that the
-program will really get to; this may not be true in a
-@code{cond}, for example.
+You must check that the position @kbd{C-M-f} finds is a place that the
+program will really get to.  In @code{cond}, for example, this may not
+be true.
 
-The @kbd{f} command does @code{forward-sexp} starting at point, rather
-than at the stop point, for flexibility.  If you want to execute one
-expression @emph{from the current stop point}, type @kbd{w} first, to
+For flexibility, the @kbd{f} command does @code{forward-sexp} starting
+at point, rather than at the stop point.  If you want to execute one
+expression @emph{from the current stop point}, first type @kbd{w}, to
 move point there, and then type @kbd{f}.
 
 The @kbd{o} command continues ``out of'' an expression.  It places a
@@ -397,7 +404,7 @@ activity.  However, instrumented code protected with
 debugging.
 
 @item Q
-Like @kbd{q} but don't stop even for protected code
+Like @kbd{q}, but don't stop even for protected code
 (@code{top-level-nonstop}).
 
 @item r
@@ -415,22 +422,30 @@ The backtrace buffer is killed automatically when you continue
 execution.
 @end table
 
-From the Edebug recursive edit, you may invoke commands that activate
-Edebug again recursively.  Any time Edebug is active, you can quit to
-the top level with @kbd{q} or abort one recursive edit level with
-@kbd{C-]}.  You can display a backtrace of all the 
-pending evaluations with @kbd{d}.
+You can invoke commands from Edebug that activate Edebug again
+recursively.  Whenever Edebug is active, you can quit to the top level
+with @kbd{q} or abort one recursive edit level with @kbd{C-]}.  You can
+display a backtrace of all the pending evaluations with @kbd{d}.
 
-@node Breakpoints
-@subsection Breakpoints
+@node Breaks
+@subsection Breaks
 
-@cindex breakpoints
-Edebug's step mode stops execution at the next stop point reached.
+Edebug's step mode stops execution when the next stop point is reached.
 There are three other ways to stop Edebug execution once it has started:
 breakpoints, the global break condition, and source breakpoints.
 
+@menu
+* Breakpoints::                 Breakpoints at stop points.
+* Global Break Condition::     Breaking on an event.
+* Source Breakpoints::         Embedding breakpoints in source code.
+@end menu
+
+@node Breakpoints
+@subsubsection Breakpoints
+
+@cindex breakpoints
 While using Edebug, you can specify @dfn{breakpoints} in the program you
-are testing: points where execution should stop.  You can set a
+are testing: these are places where execution should stop.  You can set a
 breakpoint at any stop point, as defined in @ref{Using Edebug}.  For
 setting and unsetting breakpoints, the stop point that is affected is
 the first one at or after point in the source code buffer.  Here are the
@@ -440,18 +455,18 @@ Edebug commands for breakpoints:
 @item b
 Set a breakpoint at the stop point at or after point
 (@code{edebug-set-breakpoint}).  If you use a prefix argument, the
-breakpoint is temporary (it turns off the first time it stops the
-program).
+breakpoint is temporary---it turns off the first time it stops the
+program.
 
 @item u
-Unset the breakpoint (if any) at the stop point at or after 
+Unset the breakpoint (if any) at the stop point at or after
 point (@code{edebug-unset-breakpoint}).
 
 @item x @var{condition} @key{RET}
 Set a conditional breakpoint which stops the program only if
-@var{condition} evaluates to a non-@code{nil} value
-(@code{edebug-set-conditional-breakpoint}).  With a prefix argument, the
-breakpoint is temporary.
+evaluating @var{condition} produces a non-@code{nil} value
+(@code{edebug-set-conditional-breakpoint}).  With a prefix argument,
+the breakpoint is temporary.
 
 @item B
 Move point to the next breakpoint in the current definition
@@ -463,7 +478,8 @@ with @kbd{u}.  First move point to the Edebug stop point of your choice,
 then type @kbd{b} or @kbd{u} to set or unset a breakpoint there.
 Unsetting a breakpoint where none has been set has no effect.
 
-Re-evaluating or reinstrumenting a definition forgets all its breakpoints.
+Re-evaluating or reinstrumenting a definition removes all of its
+previous breakpoints.
 
 A @dfn{conditional breakpoint} tests a condition each time the program
 gets there.  Any errors that occur as a result of evaluating the
@@ -478,7 +494,7 @@ You can make a conditional or unconditional breakpoint
 breakpoint.  When a temporary breakpoint stops the program, it is
 automatically unset.
 
-Edebug always stops or pauses at a breakpoint except when the Edebug
+Edebug always stops or pauses at a breakpoint, except when the Edebug
 mode is Go-nonstop.  In that mode, it ignores breakpoints entirely.
 
 To find out where your breakpoints are, use the @kbd{B} command, which
@@ -487,12 +503,6 @@ function, or to the first breakpoint if there are no following
 breakpoints.  This command does not continue execution---it just moves
 point in the buffer.
 
-@menu
-* Global Break Condition::     Breaking on an event. 
-* Source Breakpoints::         Embedding breakpoints in source code.
-@end menu
-
-
 @node Global Break Condition
 @subsubsection Global Break Condition
 
@@ -500,7 +510,7 @@ point in the buffer.
 @cindex global break condition
   A @dfn{global break condition} stops execution when a specified
 condition is satisfied, no matter where that may occur.  Edebug
-evaluates the global break condition at every stop point.  If it
+evaluates the global break condition at every stop point; if it
 evaluates to a non-@code{nil} value, then execution stops or pauses
 depending on the execution mode, as if a breakpoint had been hit.  If
 evaluating the condition gets an error, execution does not stop.
@@ -508,7 +518,9 @@ evaluating the condition gets an error, execution does not stop.
 @findex edebug-set-global-break-condition
   The condition expression is stored in
 @code{edebug-global-break-condition}.  You can specify a new expression
-using the @kbd{X} command (@code{edebug-set-global-break-condition}).
+using the @kbd{X} command from the source code buffer while Edebug is
+active, or using @kbd{C-x X X} from any buffer at any time, as long as
+Edebug is loaded (@code{edebug-set-global-break-condition}).
 
   The global break condition is the simplest way to find where in your
 code some event occurs, but it makes code run much more slowly.  So you
@@ -520,11 +532,12 @@ should reset the condition to @code{nil} when not using it.
 @findex edebug
 @cindex source breakpoints
   All breakpoints in a definition are forgotten each time you
-reinstrument it.  To make a breakpoint that won't be forgotten, you can
-write a @dfn{source breakpoint}, which is simply a call to the function
-@code{edebug} in your source code.  You can, of course, make such a call
-conditional.  For example, in the @code{fac} function, insert the first
-line as shown below to stop when the argument reaches zero:
+reinstrument it.  If you wish to make a breakpoint that won't be
+forgotten, you can write a @dfn{source breakpoint}, which is simply a
+call to the function @code{edebug} in your source code.  You can, of
+course, make such a call conditional.  For example, in the @code{fac}
+function, you can insert the first line as shown below, to stop when the
+argument reaches zero:
 
 @example
 (defun fac (n)
@@ -553,10 +566,10 @@ and @code{edebug-on-quit}; see @ref{Edebug Options}.
 
   When Edebug responds to an error, it shows the last stop point
 encountered before the error.  This may be the location of a call to a
-function which was not instrumented, within which the error actually
+function which was not instrumented, and within which the error actually
 occurred.  For an unbound variable error, the last known stop point
 might be quite distant from the offending variable reference.  In that
-case you might want to display a full backtrace (@pxref{Edebug Misc}).
+case, you might want to display a full backtrace (@pxref{Edebug Misc}).
 
 @c Edebug should be changed for the following: -- dan
   If you change @code{debug-on-error} or @code{debug-on-quit} while
@@ -574,19 +587,22 @@ effect outside of Edebug.
 
 @table @kbd
 @item v
-Temporarily view the outside window configuration
-(@code{edebug-view-outside}).
+Switch to viewing the outside window configuration
+(@code{edebug-view-outside}).  Type @kbd{C-x X w} to return to Edebug.
 
 @item p
-Temporarily display the outside current buffer with point at its outside
-position (@code{edebug-bounce-point}).  With a prefix argument @var{n},
-pause for @var{n} seconds instead.
+Temporarily display the outside current buffer with point at its
+outside position (@code{edebug-bounce-point}), pausing for one second
+before returning to Edebug.  With a prefix argument @var{n}, pause for
+@var{n} seconds instead.
 
 @item w
-Move point back to the current stop point (@code{edebug-where}) in the
-source code buffer.  Also, if you use this command in a different window
-displaying the same buffer, that window will be used instead to display
-the current definition in the future.
+Move point back to the current stop point in the source code buffer
+(@code{edebug-where}).
+
+If you use this command in a different window displaying the same
+buffer, that window will be used instead to display the current
+definition in the future.
 
 @item W
 @c Its function is not simply to forget the saved configuration -- dan
@@ -600,8 +616,12 @@ source code buffer, you must use @kbd{C-x X W} from the global keymap.
 
   You can view the outside window configuration with @kbd{v} or just
 bounce to the point in the current buffer with @kbd{p}, even if
-it is not normally displayed.  After moving point, you may wish to jump
-back to the stop point with @kbd{w} from a source code buffer.
+it is not normally displayed.
+
+  After moving point, you may wish to jump back to the stop point.
+You can do that with @kbd{w} from a source code buffer.  You can jump
+back to the stop point in the source code buffer from any buffer using
+@kbd{C-x X w}.
 
   Each time you use @kbd{W} to turn saving @emph{off}, Edebug forgets the
 saved outside window configuration---so that even if you turn saving
@@ -614,12 +634,12 @@ open.
 @node Edebug Eval
 @subsection Evaluation
 
-  While within Edebug, you can evaluate expressions ``as if'' Edebug were
-not running.  Edebug tries to be invisible to the expression's
+  While within Edebug, you can evaluate expressions ``as if'' Edebug
+were not running.  Edebug tries to be invisible to the expression's
 evaluation and printing.  Evaluation of expressions that cause side
-effects will work as expected except for things that Edebug explicitly
-saves and restores.  @xref{The Outside Context}, for details on this
-process.
+effects will work as expected, except for changes to data that Edebug
+explicitly saves and restores.  @xref{The Outside Context}, for details
+on this process.
 
 @table @kbd
 @item e @var{exp} @key{RET}
@@ -687,7 +707,7 @@ but they are evaluated in the context outside of Edebug.
 
   The expressions you enter interactively (and their results) are lost
 when you continue execution; but you can set up an @dfn{evaluation list}
-consisting of expressions to be evaluated each time execution stops. 
+consisting of expressions to be evaluated each time execution stops.
 
 @cindex evaluation list group
   To do this, write one or more @dfn{evaluation list groups} in the
@@ -737,9 +757,9 @@ eval-last-sexp
 To delete a group, move point into it and type @kbd{C-c C-d}, or simply
 delete the text for the group and update the evaluation list with
 @kbd{C-c C-u}.  To add a new expression to the evaluation list, insert
-the expression at a suitable place, and insert a new comment line.  (You
-need not insert dashes in the comment line---its contents don't matter.)
-Then type @kbd{C-c C-u}.
+the expression at a suitable place, insert a new comment line, then type
+@kbd{C-c C-u}.  You need not insert dashes in the comment line---its
+contents don't matter.
 
 After selecting @samp{*edebug*}, you can return to the source code
 buffer with @kbd{C-c C-w}.  The @samp{*edebug*} buffer is killed when
@@ -762,22 +782,18 @@ and @code{edebug-print-level} specify the values to use within Edebug.)
 @xref{Output Variables}.
 
 @defopt edebug-print-length
-If non-@code{nil}, bind @code{print-length} to this while printing
-results in Edebug.  The default value is @code{50}.
+If non-@code{nil}, Edebug binds @code{print-length} to this value while
+printing results.  The default value is @code{50}.
 @end defopt
 
-@defopt edebug-print-level 
-If non-@code{nil}, bind @code{print-level} to this while printing
-results in Edebug.  The default value is @code{50}.
+@defopt edebug-print-level
+If non-@code{nil}, Edebug binds @code{print-level} to this value while
+printing results.  The default value is @code{50}.
 @end defopt
 
   You can also print circular structures and structures that share
-elements more informatively by using the @file{cust-print} package.
-
-  To load @file{cust-print} and activate custom printing only for
-Edebug, simply use the command @kbd{M-x edebug-install-custom-print}.
-To restore the standard print functions, use @kbd{M-x
-edebug-uninstall-custom-print}.
+elements more informatively by binding @code{print-circle}
+to a non-@code{nil} value.
 
   Here is an example of code that creates a circular structure:
 
@@ -793,9 +809,9 @@ Custom printing prints this as @samp{Result: #1=(#1# y)}.  The
 structure.  This notation is used for any shared elements of lists or
 vectors.
 
-@defopt edebug-print-circle 
-If non-@code{nil}, bind @code{print-circle} to this while printing
-results in Edebug.  The default value is @code{nil}.
+@defopt edebug-print-circle
+If non-@code{nil}, Edebug binds @code{print-circle} to this value while
+printing results.  The default value is @code{t}.
 @end defopt
 
   Other programs can also use custom printing; see @file{cust-print.el}
@@ -814,9 +830,9 @@ trace recording, set @code{edebug-trace} to a non-@code{nil} value.
 mode (@pxref{Edebug Execution Modes}).
 
   When trace recording is enabled, each function entry and exit adds
-lines to the trace buffer.  A function entry record looks like
-@samp{::::@{} followed by the function name and argument values.  A
-function exit record looks like @samp{::::@}} followed by the function
+lines to the trace buffer.  A function entry record consists of
+@samp{::::@{}, followed by the function name and argument values.  A
+function exit record consists of @samp{::::@}}, followed by the function
 name and result of the function.
 
   The number of @samp{:}s in an entry shows its recursion depth.  You
@@ -832,8 +848,9 @@ redefining the functions @code{edebug-print-trace-before} and
 @defmac edebug-tracing string body@dots{}
 This macro requests additional trace information around the execution
 of the @var{body} forms.  The argument @var{string} specifies text
-to put in the trace buffer.  All the arguments are evaluated.
-@code{edebug-tracing} returns the value of the last form in @var{body}.
+to put in the trace buffer, after the @samp{@{} or @samp{@}}.  All
+the arguments are evaluated, and @code{edebug-tracing} returns the
+value of the last form in @var{body}.
 @end defmac
 
 @defun edebug-trace format-string &rest format-args
@@ -842,11 +859,10 @@ with @code{(apply 'format @var{format-string} @var{format-args})}.
 It also appends a newline to separate entries.
 @end defun
 
-  @code{edebug-tracing} and @code{edebug-trace} insert lines in the trace
-buffer even if Edebug is not active.
-
-  Adding text to the trace buffer also scrolls its window to show the
-last lines inserted.
+  @code{edebug-tracing} and @code{edebug-trace} insert lines in the
+trace buffer whenever they are called, even if Edebug is not active.
+Adding text to the trace buffer also scrolls its window to show the last
+lines inserted.
 
 @node Coverage Testing
 @subsection Coverage Testing
@@ -855,19 +871,28 @@ last lines inserted.
 @cindex frequency counts
 @cindex performance analysis
 Edebug provides rudimentary coverage testing and display of execution
-frequency.  Coverage testing works by comparing the result of each
-expression with the previous result; coverage is considered OK if two
-different results are found.  Thus, to sufficiently test the coverage of
-your code, try to execute it under conditions that evaluate all
-expressions more than once, and produce different results for each
-expression.  Coverage testing makes execution slower, so it is only done
-if @code{edebug-test-coverage} is non-@code{nil}.  Whether or not
-coverage testing is enabled, frequency counting is performed for all
-execution of an instrumented function, even if the execution mode is
-Go-nonstop.
-
-Use @kbd{M-x edebug-display-freq-count} to display both the
-coverage information and the frequency counts for a definition.
+frequency.
+
+  Coverage testing works by comparing the result of each expression with
+the previous result; each form in the program is considered ``covered''
+if it has returned two different values since you began testing coverage
+in the current Emacs session.  Thus, to do coverage testing on your
+program, execute it under various conditions and note whether it behaves
+correctly; Edebug will tell you when you have tried enough different
+conditions that each form has returned two different values.
+
+  Coverage testing makes execution slower, so it is only done if
+@code{edebug-test-coverage} is non-@code{nil}.  Frequency counting is
+performed for all execution of an instrumented function, even if the
+execution mode is Go-nonstop, and regardless of whether coverage testing
+is enabled.
+
+@kindex C-x X =
+@findex edebug-temp-display-freq-count
+  Use @kbd{C-x X =} (@code{edebug-display-freq-count}) to display both
+the coverage information and the frequency counts for a definition.
+Just @kbd{=} (@code{edebug-temp-display-freq-count}) displays the same
+information temporarily, only until you type another key.
 
 @deffn Command edebug-display-freq-count
 This command displays the frequency count data for each line of the
@@ -882,7 +907,7 @@ count of an earlier expression on the same line.
 
 The character @samp{=} following the count for an expression says that
 the expression has returned the same value each time it was evaluated.
-This is the only coverage information that Edebug records.
+In other words, it is not yet ``covered'' for coverage testing purposes.
 
 To clear the frequency count and coverage data for a definition,
 simply reinstrument it with @code{eval-defun}.
@@ -895,13 +920,13 @@ the breakpoint is reached, the frequency data looks like this:
 @example
 (defun fac (n)
   (if (= n 0) (edebug))
-;#6           1      0 =5 
+;#6           1      = =5
   (if (< 0 n)
-;#5         = 
+;#5         =
       (* n (fac (1- n)))
-;#    5               0  
+;#    5               0
     1))
-;#   0 
+;#   0
 @end example
 
 The comment lines show that @code{fac} was called 6 times.  The
@@ -934,16 +959,15 @@ before even deciding whether to make trace information or stop the
 program.
 
 @itemize @bullet
-@item 
+@item
 @code{max-lisp-eval-depth} and @code{max-specpdl-size} are both
 incremented once to reduce Edebug's impact on the stack.  You could,
 however, still run out of stack space when using Edebug.
 
-@item 
+@item
 The state of keyboard macro execution is saved and restored.  While
-Edebug is active, @code{executing-macro} is bound to
-@code{edebug-continue-kbd-macro}.
-
+Edebug is active, @code{executing-kbd-macro} is bound to @code{nil}
+unless @code{edebug-continue-kbd-macro} is non-@code{nil}.
 @end itemize
 
 
@@ -953,31 +977,31 @@ Edebug is active, @code{executing-macro} is bound to
 @c This paragraph is not filled, because LaLiberte's conversion script
 @c needs an xref to be on just one line.
 When Edebug needs to display something (e.g., in trace mode), it saves
-the current window configuration from ``outside'' Edebug 
+the current window configuration from ``outside'' Edebug
 (@pxref{Window Configurations}).  When you exit Edebug (by continuing
 the program), it restores the previous window configuration.
 
 Emacs redisplays only when it pauses.  Usually, when you continue
-execution, the program comes back into Edebug at a breakpoint or after
-stepping without pausing or reading input in between.  In such cases,
+execution, the program re-enters Edebug at a breakpoint or after
+stepping, without pausing or reading input in between.  In such cases,
 Emacs never gets a chance to redisplay the ``outside'' configuration.
-What you see is the same window configuration as the last time Edebug
-was active, with no interruption.
+Consequently, what you see is the same window configuration as the last
+time Edebug was active, with no interruption.
 
 Entry to Edebug for displaying something also saves and restores the
-following data, but some of these are deliberately not restored if an
-error or quit signal occurs.
+following data (though some of them are deliberately not restored if an
+error or quit signal occurs).
 
 @itemize @bullet
-@item 
+@item
 @cindex current buffer point and mark (Edebug)
 Which buffer is current, and the positions of point and the mark in the
 current buffer, are saved and restored.
 
-@item 
+@item
 @cindex window configuration (Edebug)
 The outside window configuration is saved and restored if
-@code{edebug-save-windows} is non-@code{nil} (@pxref{Edebug Display Update}).
+@code{edebug-save-windows} is non-@code{nil} (@pxref{Edebug Options}).
 
 The window configuration is not restored on error or quit, but the
 outside selected window @emph{is} reselected even on error or quit in
@@ -997,7 +1021,7 @@ The variables @code{overlay-arrow-position} and
 @code{overlay-arrow-string} are saved and restored.  So you can safely
 invoke Edebug from the recursive edit elsewhere in the same buffer.
 
-@item 
+@item
 @code{cursor-in-echo-area} is locally bound to @code{nil} so that
 the cursor shows up in the window.
 @end itemize
@@ -1013,11 +1037,12 @@ saves (and later restores) these additional data:
 The current match data.  @xref{Match Data}.
 
 @item
-@code{last-command}, @code{this-command}, @code{last-command-char},
-@code{last-input-char}, @code{last-input-event},
-@code{last-command-event}, @code{last-event-frame},
-@code{last-nonmenu-event}, and @code{track-mouse}.  Commands used within
-Edebug do not affect these variables outside of Edebug.
+The variables @code{last-command}, @code{this-command},
+@code{last-command-char}, @code{last-input-char},
+@code{last-input-event}, @code{last-command-event},
+@code{last-event-frame}, @code{last-nonmenu-event}, and
+@code{track-mouse}.  Commands used within Edebug do not affect these
+variables outside of Edebug.
 
 The key sequence returned by @code{this-command-keys} is changed by
 executing commands within Edebug and there is no way to reset
@@ -1042,14 +1067,27 @@ evaluation list window.
 by the @code{recursive-edit}, but Edebug temporarily restores them during
 evaluations.
 
-@item 
+@item
 The state of keyboard macro definition is saved and restored.  While
 Edebug is active, @code{defining-kbd-macro} is bound to
 @code{edebug-continue-kbd-macro}.
 @end itemize
 
+@node Edebug and Macros
+@subsection Edebug and Macros
+
+To make Edebug properly instrument expressions that call macros, some
+extra care is needed.  This subsection explains the details.
+
+@menu
+* Instrumenting Macro Calls::   The basic problem.
+* Specification List::         How to specify complex patterns of evaluation.
+* Backtracking::               What Edebug does when matching fails.
+* Specification Examples::     To help understand specifications.
+@end menu
+
 @node Instrumenting Macro Calls
-@subsection Instrumenting Macro Calls
+@subsubsection Instrumenting Macro Calls
 
   When Edebug instruments an expression that calls a Lisp macro, it needs
 additional information about the macro to do the job properly.  This is
@@ -1058,32 +1096,42 @@ macro call are forms to be evaluated.  (Evaluation may occur explicitly
 in the macro body, or when the resulting expansion is evaluated, or any
 time later.)
 
-  Therefore, you must define an Edebug specification for each macro that
-Edebug will encounter, to explain the format of calls to that macro.  To
-do this, use @code{def-edebug-spec}.
+  Therefore, you must define an Edebug specification for each macro
+that Edebug will encounter, to explain the format of calls to that
+macro.  To do this, add a @code{debug} declaration to the macro
+definition.  Here is a simple example that shows the specification for
+the @code{for} example macro (@pxref{Argument Evaluation}).
+
+@smallexample
+(defmacro for (var from init to final do &rest body)
+  "Execute a simple \"for\" loop.
+For example, (for i from 1 to 10 do (print i))."
+  (declare (debug (symbolp "from" form "to" form "do" &rest form)))
+  ...)
+@end smallexample
+
+  The Edebug specification says which parts of a call to the macro are
+forms to be evaluated.  For simple macros, the @var{specification}
+often looks very similar to the formal argument list of the macro
+definition, but specifications are much more general than macro
+arguments.  @xref{Defining Macros}, for more explanation of
+the @code{declare} form.
+
+  You can also define an edebug specification for a macro separately
+from the macro definition with @code{def-edebug-spec}.  Adding
+@code{debug} declarations is preferred, and more convenient, for macro
+definitions in Lisp, but @code{def-edebug-spec} makes it possible to
+define Edebug specifications for special forms implemented in C.
 
 @deffn Macro def-edebug-spec macro specification
 Specify which expressions of a call to macro @var{macro} are forms to be
-evaluated.  For simple macros, the @var{specification} often looks very
-similar to the formal argument list of the macro definition, but
-specifications are much more general than macro arguments.
+evaluated.  @var{specification} should be the edebug specification.
+Neither argument is evaluated.
 
 The @var{macro} argument can actually be any symbol, not just a macro
 name.
 @end deffn
 
-Here is a simple example that defines the specification for the
-@code{for} example macro (@code{Argument Evaluation}), followed by an
-alternative, equivalent specification.
-
-@example
-(def-edebug-spec for
-  (symbolp "from" form "to" form "do" &rest form))
-
-(def-edebug-spec for
-  (symbolp ['from form] ['to form] ['do body]))
-@end example
-
 Here is a table of the possibilities for @var{specification} and how each
 directs processing of arguments.
 
@@ -1105,12 +1153,12 @@ calling form.  The possible elements of a specification list are
 described in the following sections.
 @end table
 
-@menu
-* Specification List::         How to specify complex patterns of evaluation.
-* Backtracking::               What Edebug does when matching fails.
-* Specification Examples::     To help understand specifications.
-@end menu
-
+@vindex edebug-eval-macro-args
+If a macro has no Edebug specification, neither through a @code{debug}
+declaration nor through a @code{def-edebug-spec} call, the variable
+@code{edebug-eval-macro-args} comes into play.  If it is @code{nil},
+the default, none of the arguments is instrumented for evaluation.
+If it is non-@code{nil}, all arguments are instrumented.
 
 @node Specification List
 @subsubsection Specification List
@@ -1139,11 +1187,12 @@ balanced parentheses, recursive processing of forms, and recursion via
 indirect specifications.
 
 Here's a table of the possible elements of a specification list, with
-their meanings:
+their meanings (see @ref{Specification Examples}, for the referenced
+examples):
 
 @table @code
 @item sexp
-A single unevaluated expression, which is not instrumented.
+A single unevaluated Lisp object, which is not instrumented.
 @c an "expression" is not necessarily intended for evaluation.
 
 @item form
@@ -1168,27 +1217,28 @@ either way.
 A lambda expression with no quoting.
 
 @item &optional
-@kindex &optional @r{(Edebug)}
+@c @kindex &optional @r{(Edebug)}
 All following elements in the specification list are optional; as soon
-as one does not match, Edebug stops matching at this level.  
+as one does not match, Edebug stops matching at this level.
 
 To make just a few elements optional followed by non-optional elements,
 use @code{[&optional @var{specs}@dots{}]}.  To specify that several
 elements must all match or none, use @code{&optional
-[@var{specs}@dots{}]}.  See the @code{defun} example below.
+[@var{specs}@dots{}]}.  See the @code{defun} example.
 
 @item &rest
-@kindex &rest @r{(Edebug)}
+@c @kindex &rest @r{(Edebug)}
 All following elements in the specification list are repeated zero or
-more times.  All the elements need not match in the last repetition,
-however.
+more times.  In the last repetition, however, it is not a problem if the
+expression runs out before matching all of the elements of the
+specification list.
 
 To repeat only a few elements, use @code{[&rest @var{specs}@dots{}]}.
 To specify several elements that must all match on every repetition, use
 @code{&rest [@var{specs}@dots{}]}.
 
 @item &or
-@kindex &or @r{(Edebug)}
+@c @kindex &or @r{(Edebug)}
 Each of the following elements in the specification list is an
 alternative.  One of the alternatives must match, or the @code{&or}
 specification fails.
@@ -1198,14 +1248,14 @@ group two or more list elements as a single alternative, enclose them in
 @code{[@dots{}]}.
 
 @item &not
-@kindex &not @r{(Edebug)}
+@c @kindex &not @r{(Edebug)}
 Each of the following elements is matched as alternatives as if by using
 @code{&or}, but if any of them match, the specification fails.  If none
 of them match, nothing is matched, but the @code{&not} specification
 succeeds.
 
-@item &define 
-@kindex &define @r{(Edebug)}
+@item &define
+@c @kindex &define @r{(Edebug)}
 Indicates that the specification is for a defining form.  The defining
 form itself is not instrumented (that is, Edebug does not stop before and
 after the defining form), but forms inside it typically will be
@@ -1215,15 +1265,14 @@ a list specification.
 @item nil
 This is successful when there are no more arguments to match at the
 current argument list level; otherwise it fails.  See sublist
-specifications and the backquote example below.
+specifications and the backquote example.
 
 @item gate
 @cindex preventing backtracking
 No argument is matched but backtracking through the gate is disabled
 while matching the remainder of the specifications at this level.  This
 is primarily used to generate more specific syntax error messages.  See
-@ref{Backtracking}, for more details.  Also see the @code{let} example
-below.
+@ref{Backtracking}, for more details.  Also see the @code{let} example.
 
 @item @var{other-symbol}
 @cindex indirect specifications
@@ -1234,7 +1283,7 @@ If the symbol has an Edebug specification, this @dfn{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 @code{def-edebug-spec}
-just as for macros. See the @code{defun} example below.
+just as for macros. See the @code{defun} example.
 
 Otherwise, the symbol should be a predicate.  The predicate is called
 with the argument and the specification fails if the predicate returns
@@ -1255,7 +1304,7 @@ of @var{symbol} is the @var{string}, but the string form is preferred.
 
 @item (vector @var{elements}@dots{})
 The argument should be a vector whose elements must match the
-@var{elements} in the specification.  See the backquote example below.
+@var{elements} in the specification.  See the backquote example.
 
 @item (@var{elements}@dots{})
 Any other list is a @dfn{sublist specification} and the argument must be
@@ -1268,7 +1317,7 @@ dotted list specification may be another sublist specification (via a
 grouping or an indirect specification, e.g., @code{(spec .  [(more
 specs@dots{})])}) 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 @code{nil} specification
+example.  Also see the description of a @code{nil} specification
 above for terminating such recursion.
 
 Note that a sublist specification written as @code{(specs .  nil)}
@@ -1280,11 +1329,11 @@ sublist-elements@dots{})}.
 @c Need to document extensions with &symbol and :symbol
 
 Here is a list of additional specifications that may appear only after
-@code{&define}.  See the @code{defun} example below.
+@code{&define}.  See the @code{defun} example.
 
 @table @code
 @item name
-The argument, a symbol, is the name of the defining form. 
+The argument, a symbol, is the name of the defining form.
 
 A defining form is not required to have a name field; and it may have
 multiple name fields.
@@ -1317,7 +1366,7 @@ The argument is a single, highest-level form in a definition.  This is
 like @code{def-body}, except use this to match a single form rather than
 a list of forms.  As a special case, @code{def-form} also means that
 tracing information is not output when the form is executed.  See the
-@code{interactive} example below.
+@code{interactive} example.
 @end table
 
 @node Backtracking
@@ -1331,7 +1380,7 @@ necessarily mean a syntax error will be signaled; instead,
 exhausted.  Eventually every element of the argument list must be
 matched by some element in the specification, and every required element
 in the specification must match some argument.
-  
+
 When a syntax error is detected, it might not be reported until much
 later after higher-level alternatives have been exhausted, and with the
 point positioned further from the real error.  But if backtracking is
@@ -1355,7 +1404,7 @@ all begin with the same symbol, you can usually work around this
 constraint by factoring the symbol out of the alternatives, e.g.,
 @code{["foo" &or [first case] [second case] ...]}.
 
-Most needs are satisfied by these two ways that bactracking is
+Most needs are satisfied by these two ways that backtracking is
 automatically disabled, but occasionally it is useful to explicitly
 disable backtracking by using the @code{gate} specification.  This is
 useful when you know that no higher alternatives could apply.  See the
@@ -1382,13 +1431,13 @@ inside of the sublist to prevent backtracking once a sublist is found.
 Edebug uses the following specifications for @code{defun} and
 @code{defmacro} and the associated argument list and @code{interactive}
 specifications.  It is necessary to handle interactive forms specially
-since an expression argument it is actually evaluated outside of the
+since an expression argument is actually evaluated outside of the
 function body.
 
 @smallexample
 (def-edebug-spec defmacro defun) ; @r{Indirect ref to @code{defun} spec.}
-(def-edebug-spec defun 
-  (&define name lambda-list 
+(def-edebug-spec defun
+  (&define name lambda-list
            [&optional stringp]   ; @r{Match the doc string, if present.}
            [&optional ("interactive" interactive)]
            def-body))
@@ -1461,7 +1510,7 @@ what happens to the window configurations, it is better to set this
 variable to @code{nil}.
 
 If the value is a list, only the listed windows are saved and
-restored.  
+restored.
 
 You can use the @kbd{W} command in Edebug to change this variable
 interactively.  @xref{Edebug Display Update}.
@@ -1487,26 +1536,24 @@ mode for Edebug when it is first activated.  Possible values are
 @code{step}, @code{next}, @code{go}, @code{Go-nonstop}, @code{trace},
 @code{Trace-fast}, @code{continue}, and @code{Continue-fast}.
 
-The default value is @code{step}.  
+The default value is @code{step}.
 @xref{Edebug Execution Modes}.
 @end defopt
 
 @defopt edebug-trace
-Non-@code{nil} means display a trace of function entry and exit.
+If this is non-@code{nil}, trace each function entry and exit.
 Tracing output is displayed in a buffer named @samp{*edebug-trace*}, one
-function entry or exit per line, indented by the recursion level.  
-
-The default value is @code{nil}.  
+function entry or exit per line, indented by the recursion level.
 
 Also see @code{edebug-tracing}, in @ref{Trace Buffer}.
 @end defopt
 
-@defopt edebug-test-coverage 
+@defopt edebug-test-coverage
 If non-@code{nil}, Edebug tests coverage of all expressions debugged.
 @xref{Coverage Testing}.
 @end defopt
 
-@defopt edebug-continue-kbd-macro 
+@defopt edebug-continue-kbd-macro
 If non-@code{nil}, continue defining or executing any keyboard macro
 that is executing outside of Edebug.   Use this with caution since it is not
 debugged.
@@ -1532,7 +1579,11 @@ until the @emph{next} time Edebug is invoked via a new command.
 @c A new command is not precisely true, but that is close enough -- dan
 
 @defopt edebug-global-break-condition
-If non-@code{nil}, an expression to test for at every stop point.
-If the result is non-nil, then break.  Errors are ignored.
+If non-@code{nil}, an expression to test for at every stop point.  If
+the result is non-@code{nil}, then break.  Errors are ignored.
 @xref{Global Break Condition}.
 @end defopt
+
+@ignore
+   arch-tag: 74842db8-019f-4818-b5a4-b2de878e57fd
+@end ignore