Support Clojure & Clojurescript simultaneously better?

92 views
Skip to first unread message

Neale Swinnerton

unread,
Aug 26, 2013, 10:31:51 AM8/26/13
to nrep...@googlegroups.com
Hi,

disclaimer: i don't have a good grasp on clojurescript development, happy to be corrected if I'm talking nonsense here.

As I understand it the current best way to have a clojure and clojurescript repl at the same time is to run one as an nrepl session and the other as an inferior-lisp. e.g. start the clojure nrepl with nrepl-jack-in and the clojurescript one with inferior-lisp and a command  something like 'lein trampoline cljsbuild repl-listen'. 

It seems to me that it would be useful to support both clojure and clojurescript as first class (n)repls in the same project

The new multiple nrepl sessions gets us some of the way, but you don't get the key functionality of automatically sending clojure to the clojure repl and clojurescript to the clojurescript repl unless you run each in a separate project?

Is there any appetite for such functionality or is there some obvious existing feature I'm missing?


Neale
(@sw1nn)

Jon Pither

unread,
Aug 30, 2013, 5:40:11 AM8/30/13
to nrep...@googlegroups.com
Piggieback? Seems to work OK. You can run two nrepl sessions from the same project if you want one for plain clojure and the other for clojurescript. You have to remember which is which though.

George Oliver

unread,
Oct 2, 2013, 11:45:24 AM10/2/13
to nrep...@googlegroups.com
I'm experimenting with a similar setup and I'm interested in any feedback about how to make it work better. 

Currently I do this:

1) nrepl-jack-in from project.clj
2) nrepl and connect to the same port as from (1). At this point the two repls are basically the same. 
3) rename the buffers to keep them straight
4) launch a server on clj repl
5) setup a browser repl environment and cljs repl in the other nrepl buffer using Austin and following its sample project, https://github.com/cemerick/austin/tree/master/browser-connected-repl-sample 
6) Now if I'm working in a .clj buffer I manually nrepl-make-repl-connection-default for the clj repl
7) Also I don't reload the core.clj where the server function is, or the views.clj where the hiccup layout for the home page is; I guess this shouldn't matter with nrepl-make-repl-connection-default but I'm not sure. In views.clj I :require other namespaces which I do modify and reload.
8) refreshing the home page to see changes from reloaded .clj files usually works OK with the cljs browser repl thanks to Austin, sometimes I have to refresh the browser a couple of times to get the connection back. 

So steps 6-8 are the sticking points currently. If anyone has done work to improve this part of the workflow I'm interested in hearing it. 

Also I've tried setting up some of the buffer-local variables to point .clj buffers to the appropriate repls but my experiments haven't really seemed to work -- is anyone using that approach?


thanks, George

Phillip Lord

unread,
Nov 1, 2013, 8:59:59 AM11/1/13
to nrep...@googlegroups.com


I am a bit confused over the session parameter in nrepl.el. I'm trying
to send a string to a REPL server. This is giving me a stringp error
from current session. Ironically, if I reconnect to the REPL all works
well.

I have started the (client to the REPL) with nrepl-connect, and I have
access to the process. How do I make a new session for it?

Thanks in advance!




Debugger entered--Lisp error: (wrong-type-argument stringp nil)
nrepl-current-session()
nrepl-eval-request("(load-file \"/home/phillord/src/knowledge/ontology-clj/tawny-pizza//.sync.clj\")" nil nil)
nrepl-send-string-sync("(load-file \"/home/phillord/src/knowledge/ontology-clj/tawny-pizza//.sync.clj\")")

Phillip Lord

unread,
Nov 4, 2013, 5:41:46 AM11/4/13
to nrep...@googlegroups.com

Figured it out. The nrepl session is created asynchronously; I got this
crash because I wanted to created the session then do things with it in
the same form. But the nrepl-session isn't ready.

Bit painful!

Phil
--
Phillip Lord, Phone: +44 (0) 191 222 7827
Lecturer in Bioinformatics, Email: philli...@newcastle.ac.uk
School of Computing Science, http://homepages.cs.ncl.ac.uk/phillip.lord
Room 914 Claremont Tower, skype: russet_apples
Newcastle University, twitter: phillord
NE1 7RU
Reply all
Reply to author
Forward
0 new messages