In article 4D0348A3.2000105@gmail.com, Antony lisp.linux@gmail.com wrote:
Hi
I am trying to use bordeaux threads. Trying to figure out how to make output from a thread function appear in slime instead of the lisp terminal. The lisp I am using is Clozure Common Lisp Version 1.6-r14468M (WindowsX8664)
I beleive I have the latest bordeaux threads
Following is my test code. I hope the intentions are clear.
What am I doing wrong or missing?
Code follows Thanks, -Antony
(asdf:oos 'asdf:load-op :bordeaux-threads)
(format t "~%appearing in slime")
(defun thread-test () (format t "~%appearing in lisp terminal: ~A" (bordeaux-threads:thread-name (bordeaux-threads:current-thread))))
(let ((bindings '((*standard-input* . *standard-input*) (*standard-output* . *standard-output*) (*query-io* . *query-io*) (*trace-output* . *trace-output*)))) ;;is this correct? (dolist (name '("foo" "bar")) (bordeaux-threads:make-thread #'thread-test :name name :initial-bindings bindings)))
You can place
(setq swank:*globally-redirect-io* t)
into your ~/.swank.lisp to globally install the slime repl streams, so all output will show up in your *slime-repl ...* buffer.
Another way, next to what Vladimir said, is to use
(define-symbol-macro *repl-stream* (swank::connection.user-output (swank::default-connection)))
I'd say this question would have been more appropriate on slime-devel. :-)
Anyway, hth,
-T.