Fork me on GitHub
#cider
<
2015-06-18
>
rcecchino00:06:05

With Figwheel running in terminal and Cider REPL in emacs, println from REPL are printing in terminal ... anyone know how to get these directed to Cider?

jstokes01:06:48

i usually wrap the form in a

(with-out-str …)
but id love to know a better way

jstokes01:06:32

im not sure that helps at all if you’re inserting them for debug statements though, @rcecchino

arrdem01:06:39

rcecchino: so what happens is that when CIDER evaluates code snippets it binds *out* to a buffered writer which prints back over nREPL to emacs. If you want to capture printing to nREPL you'll need to do something like (set! *out* *out*) which seems silly but will set the root binding of *out* to the currently bound value of *out* being the nREPL printer.

arrdem01:06:07

or at least that should work. I've done similar *out* capturing stuff in nREPL before...

rcecchino01:06:12

thanks @jstokes and @arrdem ... couple things to try out

rcecchino01:06:37

fyi there's a console-print function in ns figwheel.client that is printing to CLJS repl in Emacs

isaac09:06:23

hi, every one. How to specify location of java source code of a dependency for cider? sometimes, I want to see java source code, such as clojure.

isaac09:06:57

I find I can jump to source of jdk library.

bozhidar10:06:51

you don’t have to do anything special for this

bozhidar10:06:05

if the source jars are in the classpath the lookup will work

bozhidar10:06:39

but we haven’t gotten to implementing it yet

isaac10:06:21

@bozhidar: you mean, I can simply add the source jar file to :resource-paths

gtrak14:06:45

@isaac: i think you can tell lein to add the dep with a source qualifier

gtrak14:06:42

:classifier "sources", i believe

isaac14:06:48

it’s just download source code

isaac14:06:52

[org.clojure/clojure “1.6.0” :classifier ?]

gtrak14:06:10

"sources"

gtrak14:06:28

well, you'll need both source and standard deps or things will break

gtrak14:06:30

seems there is a bug for clojure itself anyway: http://dev.clojure.org/jira/browse/CLJ-1161

enn15:06:53

It’s a little dispiriting that that is classified as minor.

mchampine15:06:43

@borkdude just re-eval the expression w/ C-M-x. That removes the "instrumentation".

mateusz-fiolka16:06:08

Does Cider debugging work in cljs?

jcsims20:06:20

is there a documented way to start nrepl from an app with both the cider handler and the refactor-nrepl middleware available?

jcsims20:06:00

i.e. what do I need to add to this: https://github.com/clojure-emacs/cider#using-embedded-nrepl-server to bring in the refactor-nrepl middleware as well?

gtrak20:06:16

this is what cider-nrepl lein plugin is doing to set up middleware: https://github.com/clojure-emacs/cider-nrepl/blob/master/src/cider_nrepl/plugin.clj#L23

gtrak20:06:23

you can add more middlewares by doing it yourself

gtrak20:06:53

though I think fnil is already going to take care of it for you.

gtrak20:06:13

if you add nrepl middlewares to your project.clj, cider's plugin might be additive

jcsims20:06:19

gtrak: I’m starting an embedded repl, I don’t think the lein plugin has any effect on that

jcsims20:06:40

basically when I call tools.nrepl’s start-server, I need a single handler to pass to it

jcsims20:06:16

cider’s handler does not include the refactor-nrepl’s middleware, so I’m trying to figure out the right incantation to wrap the handler with refactor-nrepl’s middleware as well

jcsims20:06:40

actually, what you said might help, though - I can do the same thing that cider-nrepl-handler does, and just add the refactor-nrepl middleware in the call to tools.nrepl’s default-handler

gtrak20:06:39

i can show you how lein calls nrepl, if that helps

gtrak20:06:46

cider-nrepl's handler is just calling nrepl's default handler with the middleware: https://github.com/clojure-emacs/cider-nrepl/blob/master/src/cider/nrepl.clj#L39

jcsims20:06:15

yeah that’s what I was looking at, just figuring out how to add a single middleware properly

jcsims20:06:08

wrap-refactor: https://github.com/clojure-emacs/refactor-nrepl/blob/master/src/refactor_nrepl/middleware.clj#L115 should be able to just take cider-nrepl’s handler as an argument, and return the proper handler

jcsims20:06:20

that works - something akin to:

(nrepl/start-server :port nrepl-port
                      :handler (refactor/wrap-refactor cider/cider-nrepl-handler))

jcsims20:06:35

thanks for the help, gtrak