The SLIME Trace Dialog, in package
slime-trace-dialog, is a
tracing facility, similar to Common Lisp’s
interactive rather than purely textual. It is an Emacs 24-only
You use it just like you would regular
trace: after tracing a
function, calling it causes interesting information about that
particular call to be reported.
However, instead of printing the trace results to the
*trace-output* stream (usually the REPL), the SLIME
Trace Dialog collects and stores them in your lisp environment until,
on user’s request, they are fetched into Emacs and displayed in a
dialog-like interactive view.
To use this contrib, add it to
slime-contribs in your
~/.emacs, either directly by setting up
;; setting up 'slime-fancy would also have worked (add-to-list 'slime-contribs 'slime-trace-dialog)
After starting up SLIME, SLIME’s Trace Dialog installs
a Trace menu in the menu-bar of any
slime-mode buffer and
adds two new commands, with respective key-bindings:
If point is on a symbol name, toggle tracing of its function definition. If point is not on a symbol, prompt user for a function.
With a C-u prefix argument, and if your lisp implementation allows it, attempt to decipher lambdas, methods and other complicated function signatures.
The function is traced for the SLIME Trace Dialog only, i.e. it is
not found in the list returned by Common Lisp’s
Pop to the interactive SLIME Trace Dialog buffer associated with the current connection (see Multiple connections).
Consider the (useless) program:
(defun foo (n) (if (plusp n) (* n (bar (1- n))) 1)) (defun bar (n) (if (plusp n) (* n (foo (1- n))) 1))
After tracing both
bar with C-c M-t,
(foo 2) and moving to the trace dialog with
C-c T, we are presented with this buffer.
Traced specs (2) [refresh] [untrace all] [untrace] common-lisp-user::bar [untrace] common-lisp-user::foo Trace collection status (3/3) [refresh] [clear] 0 - common-lisp-user::foo | > 2 | < 2 1 `--- common-lisp-user::bar | > 1 | < 1 2 `-- common-lisp-user::foo > 0 < 1
The dialog is divided into sections displaying the functions already traced, the trace collection progress and the actual trace tree that follow your program’s logic. The most important key-bindings in this buffer are:
Update information on the trace collection and traced specs.
Fetch the next batch of outstanding (not fetched yet) traces. With a C-u prefix argument, repeat until no more outstanding traces.
Prompt for confirmation, then clear all traces, both fetched and outstanding.
The arguments and return values below each entry are interactive
buttons. Clicking them opens the inspector
(see Inspector). Invoking M-RET
slime-trace-dialog-copy-down-to-repl) returns them to the REPL
for manipulation (see REPL). The number left of each entry
indicates its absolute position in the calling order, which might
differ from display order in case multiple threads call the same
slime-trace-dialog-hide-details-mode hides arguments and return
values so you can concentrate on the calling logic. Additionally,
slime-trace-dialog-autofollow-mode will automatically
display additional detail about an entry when the cursor moves over