[slime-devel] Re: Redirecting output from slime-compile-and-load-file?

Nikodemus Siivola nikodemus at random-state.net
Thu Nov 9 10:19:01 UTC 2006

Chris Dean <ctdean at sokitomi.com> writes:

> Matt Pillsbury <pillsbury at gmail.com> writes:
>> I was wondering if it is possible, using SBCL and SLIME, to have the
>> output (errors, warnings, et c.) from slime-compile-and-load-file
>> directed somewhere other than the REPL?
> Did you ever find a solution to this?  I'm also looking for a way to
> keep my repl clean.

Slime doesn't currently have the infrastructure for this really, not
that adding it would be too difficult.

Compiler-output controlled by *compile-print* and *compile-verbose*
should go to *standard-output*, which I believe you don't have a
problem with.

Everything else _should_ go to *error-output*, and in SBCL at least
I believe it does, so you need to bind *error-output* at the right
place to another stream. 

(defun swank-compiler (function)
  (with-simple-restart (abort "Abort SLIME compilation.")
    (multiple-value-bind (result usecs)
        (handler-bind ((compiler-condition #'record-note-for-condition))
          (let ((*error-output* your-compiler-error-output-stream)) ; <--- HERE
            (measure-time-interval function)))
      (list (to-string result)
            (format nil "~,2F" (/ usecs 1000000.0))))))

If you just want to get rid of the "noise", bind it to the result of

The more complete solution is to add another stream to the comm layer,
and have it write to *slime-compile-output* or something.


  -- Nikodemus              Schemer: "Buddha is small, clean, and serious."
                   Lispnik: "Buddha is big, has hairy armpits, and laughs."

More information about the slime-devel mailing list