Workflow troubles - exceptions in other threads

7 views
Skip to first unread message

levand

unread,
Dec 18, 2008, 10:05:16 PM12/18/08
to Clojure
I must say, this is absolutely the first thing I've found about
Clojure that is difficult or cumbersome - I've been more than pleased
with how easy everything else has been. I'm a new to Emacs+Slime, and
their learning curve has been the most difficult part, but so far I've
overcome everything.

However, I just started writing some more serious code, and am running
into a problem. I am using Swing, and, those of you who know anything
about Swing will know that most events are processed in a special
thread, the Swing event thread.

Well, I'm working in Emacs+Slime, and it appears that it is completely
deaf to anything except what happens in the main Clojure REPL thread.
A good portion of my code is executing in the swing thread, and when
an exception occurs there, there is no clue in Emacs regarding what
has taken place - it took me a while to figure out that there even was
an exception. I have to create an explicit try/catch block, and even
then, neither clojure *out* nor Java's System.out seem to be visible
to my environment. I have no idea where System.out is directed to, and
Clojure's *out* only seems to work for the REPL thread. In order to
see what happens, I have to create some other side effect in the file
system or in Swing.

Now, I could just pull in a logging framework of some kind and tail
the logs. But a lot of the joy Clojure has brought me, so far, has
been that I can just hack around in the REPL and add that stuff as
needed - it's a lot of work, just to see what's going on.

So I guess my question is... is there any easy way to see System.out
or System.err from my Slime environment? I don't mind catching the
exceptions in my code, but I need some way to to /see/ them without
dragging in a bunch of logging crap. Even Eclipse has a "console" that
tracks System.out that you can print to from any thread... that sort
of thing is a fairly basic requirement for debugging. Without it, I'm
reduced to guesswork.

Many thanks,
-Luke

Bill Clementson

unread,
Dec 18, 2008, 10:16:01 PM12/18/08
to clo...@googlegroups.com

Add the following to your .emacs file:

(add-hook 'slime-connected-hook (lambda ()
(interactive)
(slime-redirect-inferior-output)))

- Bill

levand

unread,
Dec 18, 2008, 10:25:15 PM12/18/08
to Clojure
You, sir, are a genius. Thank you! Your blog posts on clojure+slime
are excellent, too... this is what I get for trying to run with my own
setup instead of just following your example.

Many thanks,
-Luke

On Dec 18, 10:16 pm, "Bill Clementson" <billc...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages