sogaiu / ajrepl

A mode for interacting with a Janet REPL
6 stars 1 forks source link

How can I make this work with netrepl client #1

Closed Inc0n closed 1 year ago

Inc0n commented 1 year ago

I am written a game in janet, so I starts netrepl first then the draw loop.

(def s (netrepl/server "0.0.0.0" 9365 env))
(setup)
(draw-loop)

And connect using

janet -e "(import spork/netrepl) (netrepl/client)"

The problem is it will not function properly and comint to just echo entered text, it may be the prompt, but after changing comint prompt regex to "^[^ \n]\\[[0-9.]+:[0-9]+\\]:[0-9]+: ", the same problem persist.

A netrepl prompt looks like this:

[127.0.0.1:9365]:1: whatever expression
whatever expression

I am out of ideas, and would appreciate some advise on this.

sogaiu commented 1 year ago

I haven't looked into netrepl support for ajrepl but there were at least two attempts for using Emacs with spork/netrepl:

I haven't tested the former one, but I would guess it would be faster because it uses bindat, whereas the latter one was just trying to get things to work (not much attention paid to efficiency).

sogaiu commented 1 year ago

It looks like janet-netrepl uses set-process-filter-multibyte which may no longer be in Emacs 29.

From Emacs' Changelog.3:

2022-08-19 Stefan Kangas <...>

Resurrect obsoletion warning for two functions

These were supposed to have been deleted, but never were. Resurrect their obsoletion warning and let's delete them in Emacs 29 instead.

  • lisp/subr.el (process-filter-multibyte-p) (set-process-filter-multibyte): Resurrect obsoletion warning.
  • etc/NEWS: Don't announce their deletion.
sogaiu commented 1 year ago

I tried modifying janet-netrepl a bit, but didn't have much luck getting it to work.

bindat itself seems to do some kind of multibyte to unibyte conversion and I suppose it's possible this is not working so well with set-process-coding-system (which is commented out). I'm not really familiar with bindat though so the previous statement may be quite off.

May be the author of janet-netrepl would be more informed about the situation.

In some limited testing, the other option (a-janet-spork-client) seemed to still work and that uses set-process-coding-system without issues AFAICT.

Inc0n commented 1 year ago

Thank you this is very informative, I will give a-janet-spork-client a go first then.

Inc0n commented 1 year ago

a-janet-spork-client works like a charm :) 🤣 (cry of happy tears)