EAT terminal is great

(this article was requested by Port19x)

Emulate A Terminal is a very cool package I came across late last year (2022). It’s a terminal emulator built entirely in Emacs Lisp, and unlike the built-in ansi-term it’s usably fast.

how tho?

As author Akib has explained in a few places, EAT gets its speed from caching successive redraws.

Emacs was initially optimized to run inside a terminal by only modifying its own display where necessary. However, terminals are technically redrawing themselves whenever anything changes, so a terminal implemented within Emacs will ultimately be hampered by Emacs' ability to redraw the whole terminal therein.

For a simple example, try running neofetch in Vterm. Emacs will likely flicker a few times as you see the text being written out a few words at a time. In EAT, I only see 3 frames: the beginning of the logo, 3/4 of the output, and the complete readout with a new prompt. Basically,

for short bursts of output, EAT is Just Better.

Why I particularly like EAT

(eat-eshell-mode)

Eshell is not for everyone, but it’s pretty cool regardless. Howard has a good pitch which he’s presented at EmacsConf in the past - basically, it combines the shell pipeline model with Emacs' buffer system and lisp-based composition.

One major problem with eshell is that it was just a Dumb Terminal style shell, similar to comint. Thankfully this has been alleviated - EAT works in eshell, simply by adding the above line of code to your eshell-mode-hook. There’s also a mode to run full ncurses commands in a separate EAT buffer you might prefer.

And again, to restate: NO compilation step. NO system dependencies (tho it still doesn’t work on Windows). LESS painful flickering.

Problems

if running a full shell session with a complicated zsh prompt like PowerLevel10k, it might still flicker because the prompt is redrawing itself. And when tailing/catting log files, you might get an error popup about undo-limit being reached. But generally performance is still good enough, and you can just close the error buffer or even disable it.

Also, if sshing into another machine, text entry will be garbled because it doesn’t know about the TERM type eat-truecolor. Just enter TERM\=xterm-256color and you should be good to go.