[slime-devel] Re: configurable condition printing

Madhu enometh at meer.net
Mon Feb 4 10:22:55 UTC 2008


* Marco Baringer <871w7vm6m8.fsf at arsenic.bese.it> :
Wrote on Sat, 02 Feb 2008 21:43:43 +0100:

|   It's useful to control what slime prints as the condition
|   message. this can be used, among other ways, to collect and report
|   dynamic state which is import to understanding the error but isn't
|   readily available in the condition object. the attached patch adds a
|   varibale *sldb-condition-printer*, which defaults to
|   #'format-sldb-condition, to control this.

I've often wanted to reformat the condition message because the defaults
set up in *SLDB-PRINTER-SETTINGS* render the condition unreadable [for
example: by truncating too much of the message[1]].  These bindings are
already in effect by the time SAFE-CONDITION-MESSAGE (which this patch
changes) is called.

Note FORMAT-SLDB-CONDITION is merely defined to be
  (princ-to-string condition)

So even if you write a replacement for MY-FORMAT-SLDB-CONDITION, it will
still be truncated by slime when printing the sldb buffer unless you
explicitly rebind the printer variables inside the condition printer.
Although rebinding is doable, it suggests that what needs to be under
user control is really a `SAFE-CONDITION-MESSAGE' to produce the string
which sldb will render verbatim, and which is not called with modified
printer settings. (Since you have to resort to a princ-to-string in
order to get at the condition message _anyway_)

--
Madhu

[1] In CMUCL some additional variables, *DEBUG-PRINT-{LEVEL,LENGTH}*
need to be tweaked.




More information about the slime-devel mailing list