Hi Chet,
> I didn't hear anything back on this
Ah yes, sorry I ended up continuing this discussion a bit on the github
ticket (see
https://github.com/emacs-lsp/lsp-mode/issues/2709#issuecomment-3358062622).
I also am not directly subscribed to the mailing list, so I only saw
Martin's answer and missed yours. Thank you for following up on this.
> The real oddity is trying to use interactive mode without a tty
Emacs does actually invoke `ssh` with `-tt`, creating a TTY.
Essentially I wasn't aware that the kernel's TTY driver is supposed to
split reads into lines, which in theory should make everything work. The
problem was coming from the fact that emacs / TRAMP launches a shell
inside a shell inside a shell. The first shell is launched with `/bin/sh
-i`, then within that shell `INSIDE_EMACS` etc. is set and readline is
disabled when launching subsequent nested shells.
From what I can tell, the problem is then that the first shell sets the
TTY to raw mode when invoking the second shell. This shell is then
non-interactive and does not use readline, which causes it to read ahead.
I'm not entirely sure what the best resolution to this issue is. Having
the first shell not invoked without readline is one resolution to this
problem, as it prevents changing the stty behaviour for the subshells.
I'm not sure if there's another way to prevent the subshells from
entering raw mode, and I'm not sure how other shells don't run into this
issue. One could argue this should be a TRAMP change.
Maybe this provides more insight into the issue? Otherwise it sounds
like your solution fixes the problem, and I would be happy with this. I
do agree that it is an awfully special case, and that it seems a bit
unfortunate.
Thank you very much for looking into this issue!
- Rudi