Fork me on GitHub
#cider
<
2022-03-17
>
ahungry01:03:06

What cider function would swap REPL to the current buffer's ns?

eggsyntax01:03:15

cider-send-ns-form-to-repl

eggsyntax01:03:41

Bound to <LEADER>-s-n for me.

ahungry01:03:47

Oh, odd - I have "cider-version" - 1.3.0 (Ukraine) - however this function doesn't seem to exist for me - I wonder if there's a cider thing I need that isn't loaded or if it comes from another package?

eggsyntax01:03:06

Hmm, I’m back on 1.2.

ahungry01:03:30

I see here it's present in a spacemacs specific thing - I grepped cider github on master and don't see the fn

ahungry01:03:49

i'll peek at cider repo history, maybe it was there and removed, or its a spacemacs extra

eggsyntax01:03:01

Ah, ok. Yeah, for me it’s defined in the clojure spacemacs layer. My bad, thought it was a CIDER built-in.

ahungry01:03:54

is the spacemacs clojure layer available as a standalone package? (is it clojure-mode? Mine may be outdated...)

eggsyntax01:03:13

It may be clojure-mode packaged with a few other things.

eggsyntax01:03:29

Looks like you’d probably just use cider-load-buffer to evaluate the full namespace? https://docs.cider.mx/cider/usage/code_evaluation.html

ahungry01:03:03

interestingly enough, that doesn't swap active ns in the repl

eggsyntax01:03:30

Or one of these two?

eggsyntax01:03:02

🤷 I’m so used to the spacemacs overlay that I’m less familiar with the core CIDER commands, I guess.

ahungry01:03:12

it refreshes the stuff in said ns, but to actually call those things, I still need to prefix with the ns or do the (in-ns) manually - although it shouldn't be hard to extract this from the spacemacs stuff or just write a small custom function I guess 😄 - ty for the link, I'll give those two a peek

1
eggsyntax01:03:03

Surely there’s already a way to switch ns in the REPL.

ahungry01:03:15

well, yes, I can type (in-ns 'whatever) 😄

ahungry01:03:29

ok, this is in cider and all the spacemacs layer does:

(cider-insert-ns-form-in-repl t)

👍 1
eggsyntax01:03:30

I mean a standard CIDER command.

ahungry01:03:38

its just not interactive so not in the M-x completions

✔️ 1
eggsyntax01:03:45

Based on the screenshot above, it certainly seems like adding a prefix argument to cider-load-buffer-and-switch-to-repl-buffer should do it (“Use a prefix argument to change the namespace of the REPL buffer to match the currently visited source file.“)

ahungry01:03:20

Oh yup, that's right - I was missing it as it didn't have a default keybind - without prefix arg, it inserts the form but doesn't hit enter, with it, it does, thank you all for the assist

👍 1
ahungry03:03:17

Hi all - how does jack-in choose dependencies? It's pulling in com.cemeric/[email protected] which errors out on a NoSuchMethodError for some of the goog stuff in shadow-cljs when I'm using openjdk v11 (works fine on v17) - grepping, I can't find any reference to 'pomegranate' in cider repo or in my shadow-cljs (lein new re-frame reframe-stuff +cider) project. I've "fixed" it by manually setting cider-jack-in-dependencies to it's current value, but 0.4.0 swapped to 0.3.0

vemv03:03:53

what exact cider version are you using?

ahungry04:03:44

CIDER 1.3.0 (Ukraine)

vemv05:03:14

Thanks! Nothing comes to mind. cider.el generates a command such as lein update-in ... repl keeping into account your cider-jack-in-dependencies etc. What if you take that command and replace repl with deps :tree and run it in the terminal? The answer might be found there

thanks2 1
ahungry03:03:03

but I'm curious where the dependency originates from - maybe some old file I have like a leinrc or something out of dir

zendevil.eth09:03:16

My cider eval is broken. It was working fine just now but now when I do cider-connect and enter the host and port, and then try to eval an expression or a buffer, it just hangs on showing loading in the minibuffer. How to fix this?

vemv10:03:07

I don't think much has changed in this area, I'd recommend going through https://docs.cider.mx/cider/troubleshooting.html and ultimately creating a GH issue

practicalli-johnny10:03:56

Assuming Cider hasn't been updated since it was last working, the most likely cause is some long running Clojure code. Suggest stop/start the REPL process and evaluate a very simple expression, e.g. (+ 1 2) Also try evaluate in the terminal UI for the repl, helps to identify if it's a Cider or Clojure project specific issue

👍 1
vemv10:03:52

Yes excellent hints, you might as well want to verify whether this also happens in a minimal, fresh project