Fork me on GitHub
#cider
<
2020-07-07
>
pieterbreed13:07:12

Hi everyone; I have a question about the cider debugger and what "stepping in" means... With this code: (defn a [] (+ 1 1)) (defn b [] (a)) If I set up b for debugging (C-c C-c) and run it, the debugger stops inside of it. In my mind, step in is supposed to let me navigate the instruction pointer into a instead it steps over it (like I pressed n for next). Is this expected for cider? From memory, other IDE's seems to allow you to step into functions that have not been explicitly instrumented... What is the expected CIDER behaviour and what are your expectations of what step in means?

jumar13:07:41

Yes, that's expected but might depend on what a is in particular (I don't know much about limitations though). It more or less works for me in such scenarios.

pieterbreed13:07:40

the more-or-less is what I'm finding too.. .it's highly inconsistent whether I can step into a fn or not...

euccastro13:07:58

I'd like to bind a project-specific Clojure function (e.g., integrant.repl/restart ) to an emacs command, so I can bind that to a convenient keystroke. I know there's cider-run but I need to enter the function name every time and then pick a namespace. is there any way to set up my .dir-locals.el or otherwise avoid the need for that interaction?

euccastro14:07:10

OK, this worked

(defun eucc-reset-project ()
  (interactive)
  (cider-ensure-connected)
  (cider-interactive-eval "(integrant.repl/reset)"))

fappy20:07:15

Can the CIDER repl be ‘paused’ , kind of like the way you can pause a unix process with Ctrl-z ?

dpsutton21:07:33

a unix process is backgrounded with control-z and it keeps working but you can do stuff in the terminal. Can't you just got to a different buffer in emacs? aren't you doing the same thign essentially?

dpsutton21:07:23

what do you anticipate happening if a cider repl were paused?

fappy21:07:17

I’m using spacemacs and going through a period of finding out why it gets bogged down when I run my project … and hopefully I can find modes etc to disable for the repl buffer. But until then I’m hoping for a way to tell emacs “stop everything for that buffer for now so I can do other things”

dpsutton21:07:50

so you're trying to solve the problem that the repl is making emacs slow?

dpsutton21:07:08

one likely culprit is long lines and many lines in the buffer

fappy21:07:14

and until I do, I’m hoping for a Ctrl-z without the second bg part

dpsutton21:07:29

try C-u C-c C-o to clear the buffer

fappy21:07:06

can I tell CIDER to output all println’s to a file instead of the buffer?

dpsutton21:07:18

are you getting lots of logging output?

fappy21:07:25

definitely

dpsutton21:07:45

here's a helpful dir-locals.el file

((nil
  (cider-redirect-server-output-to-repl . nil)))

fappy21:07:27

I have lein running in a terminal, and I connect to it from emacs

dpsutton21:07:47

helpful if you have tons of logging. but the proper answer is configure your logger. log to a file, change the logging level, or just change the expectation that you don't want your repl to get the logs

dpsutton21:07:07

ok. restart your lein process and have cider-redirect-server-output-to-repl set to nil

dpsutton21:07:19

either through dir-local file or just set it globally in emacs if you like

fappy21:07:01

this is going to be such a great improvement!

fappy21:07:46

does the lein process itself have to be new? Or only the cider connection to it?

dpsutton21:07:57

i believe it needs to be new

dpsutton21:07:08

because in the process you hijack the stdout

fappy21:07:41

hijack? the terminal output and my tee to a file remain happy…

dpsutton21:07:12

if things are happy then don't go a-changing

ag22:07:24

I feel I asked this question before, but I completely forgot how to do this. I need execute a specific Clojure code after cider gets connected/jacks-in, can someone remind me?

practicalli-johnny22:07:38

There are configs for a reset

((clojure-mode . ((cider-refresh-before-fn . "practicalli.dev/stop")
         (cider-refresh-after-fn . "practicalli.dev/start"))))

practicalli-johnny22:07:42

Or do you mean cider-repl-init-code

ag01:07:45

That's exactly that I needed. Thank you John!

practicalli-johnny10:07:46

Please share any examples of using this if you can, thanks

ag22:07:19

tried setting cider-launch-params, that doesn't seem to work