Fork me on GitHub
#cider
<
2019-06-16
>
theeternalpulse04:06:50

Do most people here run a repl separately and just connect to it? Is there a way for new projects to have their dependencies loaded into it?

8
theeternalpulse06:06:09

I actually found the cljr hotload function but it seems not to work with later versions of java due to the way they changed loading files during runtime 😞

theeternalpulse06:06:24

you'd have to downgrade to jvm 8

theeternalpulse06:06:04

it would be cool if the cider jack in actually spawned the process outside of emacs so if it crashed you can connect back to it. Unless this is a feature already

practicalli-johnny09:06:43

@theeternalpulse the developers I know all use Jack-in so they do not need to manually manage the dependencies and versions. Any version of cider from 0.11 does this. Your question seems to suggest you are using cider 0.10 or earlier (if I have understood the question) I haven’t had Cider crash Emacs, certainly not since Emacs 25.x.x. I usually have Cider running for days and weeks without issue. The worse that has happened is I burn up all the heap with some reckless code, but even then I can do cider-interrupt.

theeternalpulse14:06:49

Righ, jack-in works fine, because the starting point is the current project so it loads the deps.edn file properly. If I start a repl with this clojure alias

:cider-nrepl {:extra-deps {cider/cider-nrepl {:mvn/version "0.21.1"}}
                :main-opts ["-m" "nrepl.cmdline"
                            "--middleware" "[cider.nrepl/cider-middleware]"]}
and connect, the starting point wasn't my project so it doesn't include the dependencies. i'm using cider 0.20 (oslo). Also my reference to crashing wasn't necessarily cider, but in general, closing emacs kills the repl process

danieroux09:06:53

@jr0cket I like to start up a separate REPL, and have the deps, port and middleware be consistent and explicit for everyone on the team.

practicalli-johnny09:06:35

So do you manage a shared .lein/ profiles.clj file in shared version control system, or do you add tool dependencies in your projects?

practicalli-johnny09:06:19

Can you elaborate why the REPL port needs to be the same? And how do you keep it the same, I thought it was random

aisamu10:06:44

Data point: I use fixed ports for convenience because they are tunneled

danieroux11:06:54

I add tool deps in my project.

:nrepl
           {:extra-deps  {nrepl             {:mvn/version "0.6.0"}
                          cider/piggieback  {:mvn/version "0.4.0"}
                          cider/cider-nrepl {:mvn/version "0.21.1"}}
            :extra-paths ["dev"]
            :main-opts   ["--main" "nrepl.cmdline"
                          "--middleware" "[cider.nrepl/cider-middleware]"
                          "--port 9000"]}

danieroux11:06:28

And the ports are fixed, because the Cursive Run configuration is also version controlled. This way, a new person on the team can checkout the code; make repl; and connect via Cider or Cursive, consistently.

danieroux09:06:32

Also, sometimes I muck up my Emacs with some new thing I want to try out, and then killing and restarting is quick

theeternalpulse14:06:59

So what you suggested above, you start a repl separately, then do cider-jack-in or connect?

theeternalpulse14:06:04

Oh I see now. You have the alias for nrepl in your project and just kick it off there from a script, so you get the deps for your project but it's not tied to emacs

theeternalpulse14:06:40

I think my problem is I'm kicking it off from my user deps.edn so it has no dependency information, this makes more sense

danieroux15:06:34

I start nrepl with the above in the project deps.edn yes, and clojure -A:nrepl - then cider-connect-clj to it.

danieroux15:06:32

I like the stability and the explicit version numbers

theeternalpulse15:06:39

right, I got you, that make sense. My perfect use case would be to have one "Central" repl that I can just connect any application into and dynamically add deps to the classpath upon connect, so then I will never have to worry about opening a new connection or if I'm working on new projects,I can start it up from my profile.clj on startup

theeternalpulse15:06:25

but seems java gets in the way of that

danieroux15:06:09

I want my repl’s to be project specific simple_smile

danieroux15:06:53

To complete the picture, I also have this:

(cider-register-cljs-repl-type 'user-custom "(start-cljs-repl)")
  (setq cider-default-cljs-repl 'user-custom)
And all my ClojureScript user.clj’s have that function defined, and piggieback and it’s middleware is also explicitly defined

theeternalpulse15:06:31

hmm, I'd have to look into that, I am on and off cljs and use shadow, but mostly on clj so not sure what that is doing

danieroux16:06:37

Swapped from shadow to figwheel last week, and my Emacs remained unchanged - it just connects to whatever that function does.

danieroux16:06:34

Now:

(defn start-cljs-repl []
  (let [build-id "common"]
    (do
      (try
        (figwheel.main.api/start build-id)
        (catch RuntimeException e
          (figwheel.main.api/cljs-repl build-id))))))

danieroux16:06:02

Then:

(defn start-cljs-repl []
  (shadow/watch :local)
  (println "Open  to connect and start an evaluation environment.")
  (shadow/repl :local))

danieroux16:06:13

Same workflow, from the REPL perspective

theeternalpulse16:06:35

is there an easy way from emacs to run the aliased command in your project on the host rather than using cider jack in?

theeternalpulse16:06:49

I'm thinking I can just make a function in elisp for it

theeternalpulse16:06:36

cider doesn't seem to accept my alies in my project deps.edn

theeternalpulse16:06:25

doing clj -A:nrepl doesn't seem to find it

theeternalpulse16:06:41

never mind, got it working

richiardiandrea18:06:39

@bozhidar is orchard going for 0.5.0 for the new info stuff? asking for a friend that needs to add :added to some code 😸