Fork me on GitHub
#cider
<
2022-05-20
>
lilactown14:05:46

another question, about multiple REPLs: how do I connect to an external REPL and have it be a "sibling" connection?

lilactown14:05:16

when I try and run cider-connect-sibling-cljs it attempts to connect to the same port

lilactown15:05:33

like what I need is the ability to connect another REPL in the session but allow me to choose a hostname/port

lilactown15:05:21

I think I got past this by writing myself a bit of elisp

lilactown15:05:02

now, I have two REPLs in the session. when I do cider-eval-last-sexp in a .cljc file it evals in... both REPLs?

lilactown15:05:09

is there a way for me to easily toggle between them instead?

yuhan15:05:32

I dabbled in a bit of cljs a few years ago and found this exact same issue - it seems that Cider assumes you want to send the form to all applicable repls all the time

yuhan15:05:22

Calva has (I think) a more sensible approach of allowing you to toggle between clj / cljs via a button

lilactown15:05:55

if I want to eval the whole ns, it makes sense to do it in both. but per-form I often have an idea of specifically where I want to run it

lilactown15:05:19

idk, I guess it forces me to rethink how I'm writing my code

yuhan15:05:58

I have a commit on my local Cider which tried to emulate this Calva behaviour - let me try and push it to Github if you want to try it out

lilactown15:05:59

dumb q: how do I properly use a local copy of cider? I'm using spacemacs

lilactown15:05:19

rn I'm editing the cider.el in my elpa folder which seems bad lol

yuhan15:05:04

hmm, I use Doom emacs now, which uses straight.el under the hood - it uses git repos for everything and makes declaring local packages really easy

lilactown15:05:42

hmmm. I'm 2 yaks deep rn - gonna leave Doom emacs on the shelf for the morning 😄

lilactown15:05:55

I'll just edit my local elpa for now

yuhan15:05:10

I used Spacemacs back in 2018, looking at my old dotfiles I had a custom "layer" with (:location local) symlinks to my local copy of Cider - not sure if things have changed in the meantime

yuhan15:05:19

Of course there's always the least elegant solution of sticking a

Cwith-eval-after-load 'cider-connection
  ... (monkey patched code) ...
)
in your init file 🙂

lilactown15:05:13

that's probably what I ought to do vs. editing the file inside of elpa

lilactown15:05:04

ok, I think I can actually solve my problem another way: modifying the nrepl middleware passed to the jack in command when I start the clojure repl

lilactown15:05:14

is there a way to do that using dir-locals?

lilactown16:05:29

hmm why is cider-jack-in-nrepl-middlewares marked as a risky local variable?

vemv16:05:04

say you're checking out some repo, said repo could set the nrepl middleware to $spyware

lilactown16:05:57

ok sure, but marking it as risky doesn't prevent that

lilactown16:05:24

or rather, doesn't do anything better

lilactown16:05:00

all marking it risky does is ensures that I have to answer the prompt every time I open a new buffer, rather than saving my preference after I have reviewed it once

vemv18:05:33

probably the pref can be saved somewhere, worth reading the docs carefully IIRC I hacked my way to disable this feature 🤷

lilactown18:05:30

I found the docs to do it via M-x customize. it just seems like such an anti-feature. security theatre more than anything else

😅 1
bozhidar06:05:58

Yeah, this was a controversial decision back in the day. Generally, I'm fine with dropping this, as I myself don't think that really help much.

bozhidar06:05:20

That's usually how things go - security and convenience rarely go hand in hand. 🙂