You can use the evaluation list buffer, called `*edebug*', to evaluate expressions interactively. You can also set up the evaluation list of expressions to be evaluated automatically each time Edebug updates the display.
edebug-visit-eval-list
).
In the `*edebug*' buffer you can use the commands of Lisp Interaction mode (see section `Lisp Interaction' in The GNU Emacs Manual) as well as these special commands:
edebug-eval-print-last-sexp
).
edebug-eval-last-sexp
).
edebug-update-eval-list
).
edebug-delete-eval-item
).
edebug-where
).
You can evaluate expressions in the evaluation list window with C-j or C-x C-e, just as you would in `*scratch*'; 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 evaluation list consisting of expressions to be evaluated each time execution stops.
To do this, write one or more evaluation list groups in the evaluation list buffer. An evaluation list group consists of one or more Lisp expressions. Groups are separated by comment lines.
The command C-c C-u (edebug-update-eval-list
) rebuilds the
evaluation list, scanning the buffer and using the first expression of
each group. (The idea is that the second expression of the group is the
value previously computed and displayed.)
Each entry to Edebug redisplays the evaluation list by inserting each expression in the buffer, followed by its current value. It also inserts comment lines so that each expression becomes its own group. Thus, if you type C-c C-u again without changing the buffer text, the evaluation list is effectively unchanged.
If an error occurs during an evaluation from the evaluation list, the error message is displayed in a string as if it were the result. Therefore, expressions that use variables not currently valid do not interrupt your debugging.
Here is an example of what the evaluation list window looks like after several expressions have been added to it:
(current-buffer) #<buffer *scratch*> ;--------------------------------------------------------------- (selected-window) #<window 16 on *scratch*> ;--------------------------------------------------------------- (point) 196 ;--------------------------------------------------------------- bad-var "Symbol's value as variable is void: bad-var" ;--------------------------------------------------------------- (recursion-depth) 0 ;--------------------------------------------------------------- this-command eval-last-sexp ;---------------------------------------------------------------
To delete a group, move point into it and type C-c C-d, or simply delete the text for the group and update the evaluation list with 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 C-c C-u.
After selecting `*edebug*', you can return to the source code buffer with C-c C-w. The `*edebug*' buffer is killed when you continue execution, and recreated next time it is needed.
Go to the first, previous, next, last section, table of contents.