gcv / julia-snail

An Emacs development environment for Julia
GNU General Public License v3.0
231 stars 21 forks source link

Add support for Eat (Emulate A Terminal) as an alternative to vterm #118

Closed gcv closed 11 months ago

gcv commented 1 year ago

Eat is a promising new Emacs terminal emulator. It seems to work substantially better than the built-in term.el, and — unlike vterm — has no external dependencies. It may allow Snail to finally support Windows (#44).

Currently known problems:

First step: see if it can be added to Snail as an alternative to vterm. Second step: check Windows compatibility.

jcmkk3 commented 1 year ago

This sounds like a good idea. I don’t think that Eat supports Windows right now, but it seems like there’s a higher chance that it could in the future than vterm. It might also be worth trying to support coterm. I’m not sure what the Windows story is like with that one. https://elpa.gnu.org/packages/coterm.html

alternateved commented 1 year ago

Currently there is no Windows support: https://codeberg.org/akib/emacs-eat/issues/35 Maintainer is open for help in that regards.

AkibAzmain commented 1 year ago

Eat doesn't support Windows because it doesn't have a way to let the terminal program know the capabilities of terminal. If you can make the program take input and print output as Eat's escape sequences (as described in the Terminal database), the OS won't matter anymore.

Note that I don't know anything about Julia and its toolings.

gcv commented 1 year ago

@AkibAzmain: Changing the Julia REPL to use Eat's own sequences probably won't happen. 🙃

I just read your thread on emacs-devel about terminal emulation (https://lists.gnu.org/archive/html/emacs-devel/2023-01/msg00132.html), and I'm pretty confused. It seems to me that Windows TUIs are quite possible (see, e.g. the Rust Crossterm library, which claims support for Windows 7 and newer). Is it a matter of providing a translation layer between terminfo-style sequences and whatever Windows 7 does?

AkibAzmain commented 1 year ago

Windows 10 (or maybe 11) supports XTerm-style escape sequences. But now the questions are: (1) can a third party terminal emulator be implemented and (b) whether Emacs has enough bindings to do that. Also, terminal emulation is not the default, it has to be enabled by the program by calling WinAPI.

It'd be best to consult someone familiar with Windows API. I don't use Windows, so I don't have much idea what to do.

It's easy to implement a POSIX terminal emulator because here a terminal is merely an interface device, but Windows doesn't have such history as far as I know.

AkibAzmain commented 1 year ago
  • As of version 0.4, Eat lacks a "line" mode, which makes it tricky to copy text out of the terminal.

Unfortunately, that's still true for version 0.6. But you can easily copy text by switching to "emacs" mode by pressing C-c C-e from semi-char mode. I want to implement line mode, but I don't have to much idea how it works (what happens when the program sends something while the user is typing at the beginning of the display?).

gcv commented 1 year ago

Thank you, @AkibAzmain, this is good information. I think our Julia project here would still benefit from Eat integration so as to simplify the dependency story, but I guess it's not a quick way to support Windows.

MasonProtter commented 1 year ago

I've been using eat for the last few days and I think it's better than vterm for my julia REPL. With vterm you had to invoke some key commands to enable copying as well, so eat is no worse than vterm for that.

gcv commented 1 year ago

@MasonProtter: I added Eat support in commit f2069f6, which is now on master. Let me know what you think.

gcv commented 11 months ago

It seems to work for me, and no one has complained in a few weeks. I'll close this ticket and wait for bug reports.