Search code examples
emacsclojurecidernrepl

print output of execution in cider repl


I am wondering if there is a way to have the output of the current execution in emacs cider when using cider-connect.

For instance :

  • I run lein repl on a project directory

  • then connect to it in emacs using cider-connect.

Now let's say that I have (println "cider is amazing by the way") in the code of one of my ring handlers, this will only be printed in the console I ran lein repl when a request is made.

How can I have this output also in my nrepl buffer ?


Solution

  • Sorry to say, I suspect that you cannot do this in the way you describe. The output is going strait to the console of that device and not through anything related to nrepl on the way. This also makes sense if you consider that nrepl is often not even running on the same computer. (the "n" in nrepl is for "network").

    Perhaps you can arrange for that output to be teed to a file where you can get at it? Then you could start a thread on your nrepl buffer that cated that file. Or have a buffer in emacs that watches the remote file.