2010/11/21 HiHeelHottie <hiheelhot...@gmail.com>:
>
> Does anybody know how to redirect the output into the repl?

Thread local bindings are not passed on to new threads. Since you
might have multiple connections to the swank server, there might me
multiple repls, each one with their own *out*. Most often though, you
only have one connection and in that case one option is to set the
root binding for *out* (which is the default value to use, if it
hasn't been overridden in the thread) to the stream connected to the
emacs buffer:

    (alter-var-root #'*out* (constantly *out*))

You should evaluate this in the repl where you want the output.

Another more general approach is to let the body of the new thread
inherit the bindings of the parent thread. This is done by bound-fn,
which has the same syntax as fn. The result of that call will be a fn,
whose body is evaluated with the same thread local bindings as the
parent thread. The thread where the bound-fn call is evaluated in is
the one from which bound-fn remembers its bindings.

In your case, the code would look like this (I took the liberty of
rearranging it a bit):

    (def my-thread
      (doto (Thread. (bound-fn [] (println "inside thread")))
        .start))

Regarding the *inferior lisp* buffer: It is where the "master" repl
will be if you start the Clojure process from within Emacs. If you
start it with lein/cake swank (which seems to be the preferred
approach nowadays), the terminal where you ran that command will play
the same role (as you already noticed).

I hope this answers your question...

// raek

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to