reddit / emacs

cling also behaving poorly so how can comint process start in `term`?

1nc0ns1st3nt · 2022-12-09 01:30
Previously, not so long ago, I [posted](https://www.reddit.com/r/emacs/comments/zg2wcf/comment/izew8ku/?context=3) about how julia is behaving badly as a result of the `TERM` environmental variable confusion. Now as I was looking to \`cling\`, a c++ interpreter. It is having some funny business too. [cling]$ 1 11 (int) 1 [cling]$ 2 22 (int) 2 [cling]$ apple aapappapplappleapple input_line_6:2:2: error: use of undeclared identifier 'apple' apple ^ [cling]$ The repeated strings right under the input prompt aren't suppose to be there, under `term` and `terminal.app` it all worked fine (i.e. without the repeated gibberish). That makes me wonder if it is possible to start a comint process using `term` or `vterm`
ieure · 2022-12-09 02:55
Comint, term, and vterm are all different things. You can't use comint inside vterm. Probably the program is echoing its input, and so is comint. Turn off one or the other.
1nc0ns1st3nt · 2022-12-10 12:13
My investigation tells me it's the cling process that's echoing the input. And there is a pattern to it as well. This is actually observable in eshell as well. So something most likely more fundamental in Emacs.
ieure · 2022-12-10 18:17
The problem is manifesting in Emacs, but isn't really *an Emacs problem*, in the same way where if you run Emacs on a computer with faulty RAM, it might crash a lot, but it's not Emacs's fault that it does so. When you enter text at a terminal, you expect feedback, in the form of the character (or action) corresponding to the key you pressed being displayed visually. Which means something has to put it there. There's a setting on either side (the terminal (or emulator); the system (or program) which it's connected to). When the terminal's local echo option is enabled, it sends the character *and displays it*, the assumption being that the remote end won't *also* display it. When local echo is disabled, the terminal sends the key and assumes the remote end will send back what it did. This was an optimization for slow links, where the latency between sending the key and roundtripping what it did caused high latency. Your problem is that both your terminal *and* the program it's connecting to are echoing, which causes the same text to get displayed twice. Further, it sounds like the program you're running doesn't understand line mode, and is operating in character mode. This is probably fine, but another sign of the degenerate times we live in, where "terminal" implies "graphical video terminal with color and cursor positioning capabilities," which is most definitely not the case for comint. Change the settings on one or the other side and your problem will be solved.
1nc0ns1st3nt · 2022-12-11 11:43
> The problem is manifesting in Emacs, but isn't really an Emacs problem, in the same way where if you run Emacs on a computer with faulty RAM, it might crash a lot, but it's not Emacs's fault that it does so. You are right, that is exactly what I wished to express, but expressed wrongly. I found `comint-process-echoes`, but this didn't help, as the echoed input is slightly different to the input. I also found something on `SetConsoleMode`, that leads to some more findings in the cling github repo. The problem not solved yet, but you have very helpful and informative, and provided me some pointers to look into. Thank you very much !