This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-06-16
Channels
- # announcements (2)
- # beginners (25)
- # calva (50)
- # cider (33)
- # clj-kondo (46)
- # cljs-dev (5)
- # cljsrn (23)
- # clojure (34)
- # clojure-dev (5)
- # clojure-russia (2)
- # clojure-spec (29)
- # clojurescript (11)
- # datomic (3)
- # docker (2)
- # duct (1)
- # emacs (11)
- # fulcro (15)
- # jobs-discuss (47)
- # off-topic (11)
- # om (2)
- # pathom (6)
- # re-frame (9)
- # reitit (4)
- # remote-jobs (1)
- # shadow-cljs (105)
- # spacemacs (4)
- # tools-deps (6)
- # xtdb (4)
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?
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 😞
you'd have to downgrade to jvm 8
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
@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.
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@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.
So do you manage a shared .lein/ profiles.clj
file in shared version control system, or do you add tool dependencies in your projects?
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
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"]}
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.
Also, sometimes I muck up my Emacs with some new thing I want to try out, and then killing and restarting is quick
So what you suggested above, you start a repl separately, then do cider-jack-in or connect?
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
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
I start nrepl with the above in the project deps.edn yes, and clojure -A:nrepl
- then cider-connect-clj
to it.
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
but seems java gets in the way of that
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 definedhmm, 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
Swapped from shadow to figwheel last week, and my Emacs remained unchanged - it just connects to whatever that function does.
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))))))
Then:
(defn start-cljs-repl []
(shadow/watch :local)
(println "Open to connect and start an evaluation environment.")
(shadow/repl :local))
is there an easy way from emacs to run the aliased command in your project on the host rather than using cider jack in?
I'm thinking I can just make a function in elisp for it
cider doesn't seem to accept my alies in my project deps.edn
doing clj -A:nrepl doesn't seem to find it
never mind, got it working
@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 😸