Fork me on GitHub
#cursive
<
2017-09-12
>
cemerick02:09:02

Is there any way to have a run configuration that evaluates an expression automatically once the REPL is up and running?

cemerick02:09:12

I feel like I'm sure I've seen this option before, but am missing it now

viniciushana02:09:41

I usually create a clj file with the expressions I want to run and reference it on the parameters field for the run config. For instance, running Figwheel:

(use 'figwheel-sidecar.repl-api)
(start-figwheel! "dev")
(cljs-repl)
Since this is run when the REPL starts, then it automatically starts a cljs REPL with Figwheel.

cemerick03:09:11

That will definitely work if you're just using clojure.main, but not if you're in an nREPL environment

viniciushana12:09:54

That's true. No idea then, sorry

cfleming22:09:25

@U09A6U6GJ No, there isn’t an option like that. Can you use user.clj?

cemerick01:09:05

@cfleming No. I can (and do) keep helper fns there, but because the nREPL session isn't set up when user.clj is loaded, I can't just e.g. put a (cljs-repl) call as a top-level.

kauko13:09:27

@cfleming any chance you could add different highlighting for namespaced vs unnamespaced keywords? A couple of times I've had errors where I mix the two, and it's hard to spot

kauko13:09:03

The errors can be pretty cryptic sometimes too, though this doesn't have anything to do with cursive 😄

kauko13:09:43

Today I had (require [my.namespace ::as my-ns]). Took a while to notice where the error was 😕

kenny18:09:42

Renaming an alias in :require seems to be broken in the latest build.

cfleming22:09:06

@kauko Sure, could you file an issue for that and I’ll add it?

kauko07:09:50

Done. Sorry I didn't notice the link in the topic 🙂

cfleming23:09:05

Awesome - thank you!

cfleming22:09:17

@kenny I’ll try that - what are you seeing?

kenny22:09:49

The symbols are not updated. If you try to do the rename action again, it thinks the alias was updated.

cfleming22:09:52

Ok, I’ll check it out, thanks.