CLJDB: Using Emacs/JDB mode with Clojure

78 views
Skip to first unread message

George Jahad

unread,
May 20, 2009, 1:51:19 PM5/20/09
to Clojure
Hi Kids:

I've been working on integrating Emacs JDB, (command line java debug
interface,) mode with Clojure. It still a work in progress, and has
some funky aspects due to language differences between Clojure and
Java, but you can catch exceptions and bring them up in the source
code, print out locals, set breakpoints and step, move up and down the
stack, all from within emacs.

Writeup is here:

http://georgejahad.com/clojure/cljdb.html

I'd appreciate any feedback.


Thanks,
g

PS. Thanks for creating such a great community!

David Nolen

unread,
May 20, 2009, 2:20:07 PM5/20/09
to clo...@googlegroups.com
Wow this sounds fantastic. Wanna put this on GitHub so people can fork it and work on it concurrently? ;)

George Jahad

unread,
May 20, 2009, 3:26:40 PM5/20/09
to Clojure


On May 20, 11:20 am, David Nolen <dnolen.li...@gmail.com> wrote:
> Wow this sounds fantastic. Wanna put this on GitHub so people can fork it
> and work on it concurrently? ;)



Good idea:

http://github.com/GeorgeJahad/cljdb/tree/master

David Nolen

unread,
May 20, 2009, 4:08:07 PM5/20/09
to clo...@googlegroups.com
Wow, that was quick thanks.

David Nolen

unread,
May 25, 2009, 7:51:02 PM5/25/09
to clo...@googlegroups.com
Just got around to messing with this today, this is great.

I note that cljdb can't point to the exact location inside of Clojure source files (it works in Java files). It knows where you are, but you don't get line highlighting or the line pointer in .clj files.

Is this difficult to implement?

Thanks for creating this! Being able to step through and examine locals is a fantastic thing.

George Jahad

unread,
May 25, 2009, 8:35:11 PM5/25/09
to Clojure


On May 25, 4:51 pm, David Nolen <dnolen.li...@gmail.com> wrote:
> Just got around to messing with this today, this is great.
> I note that cljdb can't point to the exact location inside of Clojure source
> files (it works in Java files). It knows where you are, but you don't get
> line highlighting or the line pointer in .clj files.
>
> Is this difficult to implement?
>

That's odd; it does work already for me. The line pointer should move
as you step through .clj files. Have you run through the "Set
Breakpoint" section from the doc here: http://georgejahad.com/clojure/cljdb.html
? Does that fail in the same way? Also, which version of emacs are
you using and on what platform?

> Thanks for creating this! Being able to step through and examine locals is a
> fantastic thing.
>

It's still a work in progress, but I've been finding it pretty useful
so far.

Thanks for trying it!

g

David Nolen

unread,
May 25, 2009, 8:53:02 PM5/25/09
to clo...@googlegroups.com
Oops actually it works for .clj files that have been loaded via :use and :require in the ns declaration, but not for the source file you're editing (it seems). Have you found a workaround for this or have a usage pattern where you can get it to work for the current file being edited?

George Jahad

unread,
May 25, 2009, 9:23:50 PM5/25/09
to Clojure


On May 25, 5:53 pm, David Nolen <dnolen.li...@gmail.com> wrote:
> Oops actually it works for .clj files that have been loaded via :use and
> :require in the ns declaration, but not for the source file you're editing
> (it seems). Have you found a workaround for this or have a usage pattern
> where you can get it to work for the current file being edited?
>

I think the problem you are running into is that breakpoints get
messed up when you reload a file, (or a single function if you are
using slime.) You have to restart the jvm each time you want to
reload a file. It's a known problem (mentioned in the doc.) I think I
have a fix for it, but I'm on vacation with this week and won't get to
it till next week or so.

For now, you'll just have to restart the vm. I'll let you know in a
week or two when I have a fix.

g

Reply all
Reply to author
Forward
0 new messages