Fork me on GitHub
#emacs
<
2019-09-20
>
nenadalm17:09:43

Hi. I am using Cider for development. Is it possible to convince Emacs that directory outside of project is part of it? So that if I switch to the other directory I can still use repl and other features? project layout: project1/src - sources of project1 (uses Leiningen) project2/src - sources of project2 (uses Leiningen) shared/src - shared sources between project1 and project2 (no Leiningen or other dependency tool) I know that in Clojure I can cider-jack-in inside project1, then open file in shared and connect to the repl via cider-connect and that's great. Problem is with ClojureScript though. I use figwheel-main and I am not sure if it's possible to connect to the project1 repl from shared (I can connect to the Clojure repl, but not to the ClojureScript part). So I thought that maybe it's somehow possible to tell Emacs that sources of project1 are inside of project1/src and shared/src. Also that sources of project2 are inside project2/src and shared/src. I thought that maybe projectile could help but it looks like I can just mark any directory as project but cannot include any directories from outside (https://github.com/bbatsov/projectile). I've also tried symlinks but they didn't work either.

nenadalm18:09:07

So I found that after cider-connect in shared, I can run (figwheel.main.api/cljs-repl "dev") to connect to the cljs (https://figwheel.org/docs/scripting_api.html). Still - if someone knew about better way (not having to run 2 commands, but make it work somehow so that Cider would understand that shared should user repls from project1 and project2), that would be nice.

practicalli-johnny18:09:02

there is a #cider channel which may offer more help

bozhidar07:09:31

There’s a way to associate this with one project, but not with two, as that would mess up the REPL lookup logic if you eval something in the shared folder. How would you know then which REPL to use? Back in the day there was an option to manually force the REPL to be used for all evaluations, but these days we try to infer all of this automatically based on the mappings that we created between project files and REPL buffers.

nenadalm08:09:35

I assumed that based on https://docs.cider.mx/cider/0.22.0/usage/managing_connections.html#_current_session: > If multiple sessions are linked to a context (say, a project) then the current session is the one containing the most recently viewed REPL. If I had running repl for both projects, the one I viewed the buffer last for would be used in shared folder (and I could switch them by viewing buffer of the other repl).

bozhidar08:09:41

I had forgotten about this. Yeah, then it seems the last REPL you used should determine which session the shared folder would be associated with.

bozhidar08:09:09

I haven’t touched the code there in ages and it’s all starting to get blurry in my head. 🙂