emacs

bozhidar 2026-05-11T20:51:06.128799Z

This might be interesting to some of you https://clojurians.slack.com/archives/C06MAR553/p1778530093658339

❀️ 1
ag 2026-05-11T21:10:28.737709Z

Interesting. Just out of curiosity, ever discussed replacing nrepl with it in CIDER? Somehow, I have not heard of prepl.

dpsutton 2026-05-11T21:39:27.953439Z

woa. this is essentially how i use inf-clojure. not needing deps and having servers not require the main is so, so, so useful

bozhidar 2026-05-12T07:49:20.439519Z

@ag Replacing nREPL in CIDER was never discussed or considered. What was discussed in the past was to add support for the socket repl (and later on for prepl as it was more useful than the socket repl for something like CIDER). It's fairly hard to build complex functionality on top of prepl, as everything has to be done in terms of evaluating code, but it works reasonably well for the basic functionality that probably the bulk of the users rely one. Still, for something like advanced code completion you'd need to have a completion library like compliment in your deps so you can evaluate forms from it for the completion, etc.

2
enn 2026-05-20T20:51:19.660529Z

With that change I can get a little further, but it still hangs before I can fully type a (d/entity db [:foo/id #uuid ]) call

bozhidar 2026-05-21T04:12:39.388629Z

Hmm, I guess I'll have to keep investigating.

bozhidar 2026-05-21T04:22:02.653519Z

The fastest way for me to know what's actually stuck is a backtrace from the moment of the hang:

M-x toggle-debug-on-quit RET     ;; arm C-g for a backtrace
  ;; trigger the hang
  C-g                              ;; interrupts; *Backtrace* opens
The top of that backtrace tells us exactly where Emacs is getting stuck β€” eg. pp, accept-process-output, the EDN parser, the filter, capf, etc. Please paste the top 15-20 frames.

bozhidar 2026-05-21T04:24:50.590459Z

The two ideas I think are plausible for your problem is that either the completion cache is causing the freeze or you still have the message log enabled and dumping the massive cache there is causing things to get stuck. You can try first:

(setq port-completion-use-cache nil)

bozhidar 2026-05-21T04:25:07.818189Z

But the backtrace would help most.

enn 2026-05-21T05:39:14.907099Z

Thanks, I appreciate your help with this. I will work on getting that backtrace tomorrow.

πŸ‘ 1
bozhidar 2026-05-21T05:40:25.362749Z

Great! In the mean time I've added a troubleshooting section to the README, which you might find helpful tomorrow https://github.com/clojure-emacs/port#troubleshooting

enn 2026-05-19T18:29:40.283539Z

Hi Bozhidar, this seems really cool. I have been trying to use it but it pretty frequently fully hangs Emacs to the point where I have to kill it. This happens under various circumstances. One consistent recipe to make it happen is to type (d/entity db [: in the REPL. I then cannot type anything more after that.

enn 2026-05-19T18:30:18.188229Z

Any thoughts on how to troubleshoot? This is in terminal-mode emacs (`-nw`) on Mac OS.

bozhidar 2026-05-19T19:12:59.449089Z

@enn My guess is that some of the tooling Clojure code that port evals hangs in some situations, so we'll need to figure out what exactly is causing the hang. I just added a command called port-toggle-message-log that you can use to monitor what gets send by port when it hangs - this will help us a lot with debugging the problem.

1
bozhidar 2026-05-19T19:13:21.379209Z

Sadly, there's no way in prepl to interrupt an evaluation, so bad evals are pretty dangerous there... 😞

dpsutton 2026-05-19T19:13:57.538959Z

nrepl relies on a mechanism that is deprecated as well, right? or is there a newer way that will be maintained?

bozhidar 2026-05-19T19:17:25.072039Z

@dpsutton We've solved the problem permanently a while ago with a JVMTI agent https://nrepl.org/nrepl/installation.html#jvmti

πŸ‘€ 1
bozhidar 2026-05-19T19:18:06.380639Z

It's a more complicated solution than the one that got deprecated, but it works pretty well.

dpsutton 2026-05-19T20:05:08.755709Z

https://docs.oracle.com/en/java/javase/21/docs/specs/jvmti.html#threadCategory wow. interesting! glad my knowledge was out of date

πŸ‘ 1
enn 2026-05-19T20:50:17.957759Z

@bozhidar I tried it with the message log on, this is the last thing I see in *port-messages* . I can't copy the text because Emacs becomes unresponsive, but it looks like some kind of string out of bounds issue? I don't think it's an issue with a bad evaluation becaause it happens before I hit enter to submit anything to the REPL.

bozhidar 2026-05-20T04:59:22.591489Z

@enn I meant "bad tooling evaluation" and your screenshot kind of confirmed this. I discovered a parsing inefficiency of large prepl responses (like this completion response from the screenshot) and I think I've managed to address it by making the parsing logic a bit smarter for such multi-chunk messages. See https://github.com/clojure-emacs/port/commit/32cc27fa6612f8bab308082b090a838488cc117c and try updating the Port to see if the fix works well for you.

bozhidar 2026-05-28T12:12:09.917759Z

Hmm, that’s super weird. Normally you should get a backtrace at this point.

enn 2026-05-26T17:51:34.511939Z

@bozhidar I tried reproing with debug-on-quit enabled, but just got pages and pages of binary out to the terminal.