Fork me on GitHub
#cider
<
2016-12-14
>
mikerod00:12:07

Maybe I’m being dumb, but is there a way to jump to Java source with Cider in Emacs?

mikerod00:12:18

I don’t see anything in the docs I’ve been able to find via searching

rmuslimov00:12:20

I beliebe M-. should work, no?

mikerod00:12:10

@rmuslimov “wrong type argument: stringp, nil” is what I most commonly get

mikerod00:12:32

Sometimes I do get the “Member in prompt:” minibuffer message

mikerod00:12:41

but it is not the correct classes and none work. hmmm

rmuslimov00:12:25

weird, it works well in my cider

agile_geek07:12:42

@mikerod I sometimes find I have to eval the buffer before M-. works. Try C-c C-k first.

mikerod13:12:36

@agile_geek interesting. I’ll have to look into this more. I was specifically trying to navigate to a Java method definition from the REPL buffer, so maybe that is the issue

mikerod13:12:28

Here is another Cider question: are there any debugger sort of features that would allow break points to be in Java code that is executed from a Clojure callstack? I’m thinking that is a no, but just seeing if there is anything to look into in that area.

mikerod13:12:58

@agile_geek I still get the same "wrong type argument: stringp, nil” or I get “Symbol XXXX not resolvable"

agile_geek13:12:07

Not sure about Java code ...obviously there are for Clojure code. I would think not.

mikerod13:12:20

I’m not sure what I have setup wrong to get this working. I’ll have to dig through the client/middleware to probably understand what it is doing

mikerod13:12:25

maybe my source jars aren’t found or something

agile_geek13:12:39

I think your problem is you're try to jump to Java source and not sure CIDER supports that

mikerod13:12:46

Yeah, I know there is the Clojure code debugger. I just wondered if anyone ever tried to cross over into Java land with a debugger as well.

mikerod13:12:55

Yes, I’m trying to jump to Java source

mikerod13:12:12

Currently, when I work with Java interop often, I end up just using Eclipse to navigate Java files

mikerod13:12:28

so I was trying to decide how hard it would be to get Emacs to let me do this all there

mikerod13:12:48

Also, to debug Java code (yuck), that I’m calling from Clojure, I have to use Eclipse CounterClockwise plugin

mikerod13:12:47

it actually does have the feature of letting you use the REPL but have breakpoints in Java code you are calling and it pauses and everything like yoi’d expect in a Java debugger. That is one of the only features of CCW that I’m actually pretty happy about. However, I’m much more a fan of Cider/Emacs - it’s just the interop features I’m wishing were there.

mikerod13:12:10

I guess it doesn’t matter to many clj people if interop is relatively rare

agile_geek13:12:49

You could use IntelliJ and Cursive which is much more sane than Counterclockwise but there's a cost

mikerod13:12:57

yeah, it’s just the cost there

mikerod13:12:16

I rarely have to resort to debugging Java code

mikerod13:12:20

so for the most part it doesn’t get in my way

mikerod13:12:30

I do read a lot of the Java code and navigate around, but that tends to be enough

mikerod13:12:32

However, some Java lib code can be hard to just read and figure out. I really don’t like debugging step-by-step, but sometimes that’s what I have to resort to understand a bunch of stateful objects acting as a “machine” in some Java libs.

agile_geek13:12:32

You could try an Emacs package for Java

mikerod13:12:05

Yeah, I thought I might look into that some. Last I looked I thought it didn’t seem to be used much, but I’ll revisit it out of curiousity

agile_geek13:12:38

@mikerod I've been meaning to try this but haven't yet https://github.com/mopemope/meghanada-emacs

mikerod14:12:46

@agile_geek interesting, I will check this one out

agile_geek15:12:28

@mikerod another option that uses Eclipse in the background - https://github.com/senny/emacs-eclim

mikerod15:12:21

@agile_geek another interesting one

agile_geek15:12:48

then there' s good old jdee of course

richiardiandrea16:12:42

About Java, some people had a very good idea, jdee folks started to implement an nrepl middleware

richiardiandrea16:12:52

Same as cider, it could provide all the jdk-related functionalities, some of them could be grabbed from cider itself

mikerod19:12:26

@richiardiandrea some more stuff to read through

mikerod19:12:47

I would be surprised if people weren’t regularly doing at leasts some level of Java interop in Clojure.

mikerod19:12:56

if you use existing libraries, I’d think you’re boudn to hit some

richiardiandrea19:12:09

yes, there is no pre-made option for Java now, that is why it is important to build it ourselves 🙂

mlev19:12:20

When I run cider-jack-in on a new lein new APPNAME project utilizing selmer in APPNAME.core as in (ns APPNAME.core (:require [selmer.parser :as selmer])) it defaults to a buffer cider-repl APPNAME with a prompt of user>. However, when I try to run (selmer/render "Hello, {{name}}" {:name "World"}) in the repl, I get the following error message: CompilerException java.lang.RuntimeException: No such namespace: selmer, compiling:(*cider-repl APPNAME*:43:7). I have already restarted Emacs and the CIDER repl several times. Does anyone know what I can do to fix this issue?

mlev19:12:33

Does it have to do with the fact that the CIDER repl is not defaulting to the APPNAME.core> prompt, so perhaps its in the wrong namespace?

mlev19:12:15

Curiously, though, it does produce "Hello, World" when I put (selmer.parser/render "Hello, {{name}}" {:name "World"}) in the repl...

dpsutton19:12:08

i think you are absolutely qualifying the call to render whereas selmer/render is using the aliased namespace, which has not been aliased in the current user namespace

dpsutton19:12:21

yes, if you switch to APPNAME.core you can use the alias

dpsutton19:12:49

or you can use the fully qualified name in any namespace

mlev19:12:46

Thanks @dpsutton . I am trying to switch the namespace in the repl using (in-ns APPNAME.core) but I get the error: CompilerException java.lang.ClassNotFoundException: APPNAME.core, compiling:(*cider-repl APPNAME*:49:7)

dpsutton19:12:24

i always use C-u C-c M-z which switches to whatever namespace I'm in and puts point in the repl

dpsutton19:12:52

which sounds like a mouthful but I honestly can't remember the shortcuts to type them out but my hands just spit them out by memory now

mlev19:12:13

@dpsutton , worked like a charm 🙂 Thanks for your help!

chadhs22:12:55

is there a way to prevent cider-repl buffer from changing window sizes when it launches?

chadhs22:12:03

or perhaps a way to constrain it?