Hey guys. Would inf-clojure be interested in having pREPL support? I still don't know whether it makes sense putting it into inf-clojure vs making it its own thing, but @borkdude suggested that, so I thought I'd ask what do you guys think. In the meantime I created #emacs-prepl for the discussion, at this stage nothing's certain in terms of how things will be done, but I do want pREPL in Emacs (here's https://raw.githack.com/jakub-stastny/playground/master/doc/exploration.html I'm trying to achieve by this).
@bozhidar I think inf-clojure already has socket support (which prepl is also a variation of) but it needs to parse the EDN response and @jakub.stastny.pt_serv asked about inline eval which maybe would put it more on the side of #cider functionality. Either way, I think it's good to talk to each other
The behaviour would be more akin to Cider, definitely. In a nutshell what I want is C-x C-e to show result in the source buffer, just like Cider does. Inf-clojure doesn't do it, because it doesn't know what is STDOUT/STDERR/return value (stating the obvious here). Screen space is an issue essentially, I don't want to work in split view source/REPL unless I have a good reason for it (as in, when I start a subREPL, then yes, I want the split view, but not otherwise).
Full spec here https://raw.githack.com/jakub-stastny/playground/master/doc/exploration.html it's in the exploratory stage, but I think I'm getting a fair idea now. Essentially what I need is an Emacs package I was wondering whether it'd make sense to make it part of any existing package. With that said I'm not overly familiar with Elisp and I doubt I'd be able to orient myself efficiently in Cider codebase (I can probably get by in inf-clojure).
@bozhidar thanks for your work on these tools by the way. Cider's awesome.
I agree that adding support to inf-clojure should be fairly straightforward - it's mostly a matter of parsing the EDN output you'd get from prepl. https://github.com/clojure-emacs/parseedn should be able to help you with this.
I'm guessing that you'll also need something like a inf-clojure-connect-prepl (or similar) command, so you can also establish what kind of REPL backend you'll be using, so that inf-clojure would know it's supposed to expect EDN output there, instead of plain text.
Or alternatively you can try some auto-detection based on the structure of the response, but I guess that'd be more complex to implement.
Well I'm not sure whether I'd call it straightforward, firstly because in pREPL mode inf-clojure would have to behave much more like Cider, but OK if there's interest, let me have a think about how it should behave and I'll make a proposal (whenever I have time, it might take a while). I also need to learn more about inf-clojure, I only installed it last weekend.
Btw, there was already a PR in the past to add inline evaluations to inf-clojure https://github.com/clojure-emacs/inf-clojure/pull/140 but sadly it never made it to the finish line (it borrowed a bit of code from CIDER).
> I'd call it straightforward, firstly because in pREPL mode inf-clojure would have to behave much more like Cider, but OK if there's interest,
Oh great, a starting point. Thanks for the link.
It's straightforward compared to making CIDER support pREPL. 🙂 This was on my radar in the past, but when I became the maintainer of nREPL I dropped the idea to work in this direction.
(but it's certainly doable - an extra connection backend and making eval command dispatch based on the connection backend)
Haha fair enough.