Fork me on GitHub
Drew Verlee01:08:54

How would i eval clojure code in the context of a specific nrepl (the one started from the project), from a cider/elisp function? I was thinking `hmm, any chance you know how to have cider eval some clojure code in the repl it just started? the only thing i see is

(cider-read-and-eval "(println 'hi')")
To add some context, i want to either start my http server with a emacs short cut or just have it turned on by default when i start a repl from the project.


I would use nrepl-sync-request:eval or nrepl-request:eval > To add some context, i want to either start my http server with a emacs short cut or just have it turned on by default when i start a repl from the project. I think the idiomatic thing would be to have a shortcut to Component-/Integrant- (reset) your system. That way you use the same shortcut at repl startup and later on

👀 1
👍 1

(cider-insert-in-repl "(println 'hi')" t) ?

👀 1
Harri Kiiskinen13:08:39

I'm trying to get the following to work: I'm on Emacs Windows, the code is on a Linux box, and I open it using Tramp. I'm trying to cider-jack-in-clj but first the call fails with error in process sentinel: Could not start nREPL server: /bin/sh: 2: powershell: not found. The command used is clojure-cli . According to docs (, CIDER should handle remote files transparently, but in this case this is not true. This I can override by manually setting cider-clojure-cli-command to clojure . But the process still fails: the ssh tunnel to access the remote nrepl is not created correctly. CIDER calls this to set up the tunnel: start /b cmd /c "\Program Files\Emacs\x86_64\libexec\emacs\27.2\x86_64-w64-mingw32\cmdproxy.exe" -c "c:/Windows/System32/OpenSSH/ssh.exe -v -N -L 35627:localhost:35627 ''" . This gives the error "'\Program' is not recognized as an internal or external command, operable program or batch file." If I remove the whole start /b cmd /c from the beginning, and just call cmdproxy on command line, there is no problem; except that the host name should not be surrounded by single quotes. By setting up the tunnel manually, everything seems to work out fine, so there's something wrong with how the tunnel is set up. I don't know much about Windows (I'd rather work with Linux, but you work with the tools your given.) so I don't know what is the correct way the construct this tunnel, but this does seem a bit complicated. Is there something in the CIDER configuration that I could set to fix this?

Harri Kiiskinen13:08:23

The single quotes are added in the function nrepl--ssh-tunnel-command . I wonder if these are really necessary? When removing from this, a tunnel can be started with start-process-shell-command as is done in nrepl--ssh-tunnel-connect .


Are you able to obtain the whole stracktrace?

Brian Marco13:08:01

I am getting this error on all my projects, but I am running it in this case my deps.edn looks like

{:deps {org.clojure/clojure {:mvn/version "1.11.1"}}
 :paths ["src" "resources"]

Brian Marco13:08:23

I am on linux. I am running PopOS, but using guix as my package manager


yeah you'll need to install a full jdk you can find the command for guix in the link

Brian Marco13:08:58

That was exactly it! Thanks I just needed to add the :jdk to my manifest