Fork me on GitHub
#inf-clojure
<
2023-04-11
>
Jakub Šťastný13:04:47

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 #C052EBRRU4S 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).

borkdude13:04:24

@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 #C0617A8PQ functionality. Either way, I think it's good to talk to each other

🙏 2
Jakub Šťastný13:04:49

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).

Jakub Šťastný13:04:34

@bozhidar thanks for your work on these tools by the way. Cider's awesome.

bozhidar14:04:35

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.

bozhidar14:04:23

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.

bozhidar14:04:11

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.

Jakub Šťastný14:04:33

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.

bozhidar14:04:01

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).

👍 2
bozhidar14:04:29

> 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,

Jakub Šťastný14:04:27

Oh great, a starting point. Thanks for the link.

bozhidar14:04:39

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.

bozhidar14:04:46

(but it's certainly doable - an extra connection backend and making eval command dispatch based on the connection backend)

Jakub Šťastný14:04:07

Haha fair enough.