Fork me on GitHub
#cider
<
2017-07-19
>
jumar11:07:23

I've found an interesting way how to temporarily modify the code of 3rd party clojure library (e.g. for debugging purposes - adding println statements, etc.) and apply the changes to current REPL. Let's take as an example clj-http library: 1. run cider-open-classpath-entry 2. search for clj-http; open (ENTER) 3. search for namespace, e.g. clj_http/core.clj; open (ENTER) 4. search for function of interest, e.g. get-route-planner modify 5. eval in cider repl - answer "n" to question "File ... is read-only on disk. Make buffer read-only, too?"

jumar11:07:51

I wonder if anyone else ever do similar stuff and whether there's a more reasonable/convenient approach to do this

hans11:07:35

@jumar I do this regularily. But I use M-. to go to the source of the function/macro in question and C-x C-q to make the buffer writeable.

jumar11:07:47

@hans this is much easier. Thank you!

hans11:07:06

@jumar also, i use C-M-x to evaluate the form that I'm currently editing in a buffer. no need to deal with the repl, really

jumar12:07:40

I use that too (eval buffer or eval function) - I've just used wrong words ("eval in cider repl") in my former post