tpapp / julia-repl

Run an inferior Julia REPL in a terminal inside Emacs
Other
169 stars 35 forks source link

`julia-repl-activate-parent` should start Julia with `--project=...` if it starts a new session #135

Open chriselrod opened 1 year ago

chriselrod commented 1 year ago

This is a feature request.

The motivation is that the home project and the project one is working in may have incompatible package versions, some of which get loaded in the startup.jl.

That is, if starting julia with julia --project=my/project, my/project gets activated before startup.jl gets loaded, so the incompatible versions between my/project and the default environment aren't an issues.

If I start julia (running startup.jl) and then activate my/project, some packages in it will fail to precompile because of the conflicts.

My current workaround is to add --startup=no to the Julia repl-switches.

But it'd be nice not to need this. (Of course that means I'd have to launch the julia-repl via C-c C-a, but I normally do that anyway.)

It looks like an implementation could call julia-repl--locate-live-buffer. If it returns non-nill, send the string like the implementation currently does. Otherwise, replicate the logic from julia-repl-inferior-buffer, but with the --project= switch added to julia-repl-switches.

tpapp commented 1 year ago

I am happy to address this, but what should the project directory be? whereever a Project.toml is found in the parent directories, when julia-repl is called from a buffer that is associated with a file?

hexaeder commented 1 year ago

For me, setting (setq julia-repl-switches "--project=@.") totally did the trick. Normally I'll activate the repl from some file withing the project and @. seems to work fairly well in just activating what i mean. Havn't tested it with nested test environments though.