Eat and Eat powered Eshell, fast featureful terminal inside Emacs
Akib Azmain Turja (he/him) - IRC: akib, https://akib.codeberg.page Fediverse: akib@hostux.social, akib@disroot.org
Format: 9-min talk; Q&A: Etherpad
Status: Q&A to be extracted from the room recordings
Description
Eat is a terminal emulator for Emacs, written in pure Emacs Lisp. It can run most (if not all) terminal programs. Despite being implemented in Emacs Lisp, it is fast enough for day-to-day uses.
In this talk, I'll give an overview of Eat, its features and configuration. I'll show the most useful features and the features that make Eat unique (e.g. shell integration, mouse tracking, Sixel support). (This may include features that hasn't been implemented yet but will be implemented and stable enough by the time of the recording of the talk.) Most of the features require no configuration to use, but are configurable with user options. I'll also show the most useful customization options available that users may want to customize or tinker with.
Thanks to the architecture of Eat, Eat can emulate terminal within any region of a buffer. Therefore, Eat can be integrated with Eshell. I'll show how to integrate Eat with Eshell, and the useful Eshell-specific features and configuration.
Then, I'll compare Eat with other terminal emulators available for Emacs, and I'll show which feature that Eat has but the other doesn't, and which feature Eat lacks. I'll show why Eat is good or bad for some users/use cases. For example, why Shell mode users may prefer Coterm (a terminal emulator for Comint) over Eat, why Eat is better Term mode in the most cases, or why Vterm should be prefered for huge bursts of outputs, etc.
Then I'll give pointers to the documentation available like the Info manual or README and what they contain. And I'll also discuss what to do when you hit a problem. I'll discuss about the common problems or misconfiguration, and also discuss where and how to report bugs properly. I won't go into much details in this part, since the manual covers this topic completely, and the users are expected to not encounter problems.
Then I'll discuss the future plans of the project. And finally, I'll conclude the talk with a summary of the whole talk.
Outline:
- Introduction: What's Eat and why?
- Installing Eat from NonGNU ELPA
- Demonstrating Eat's features and configuring them
- Eshell integration
- Comparison with other terminal emulators
- Shortcomings and common (fixable) problems
- Future plans
- Conclusion
Discussion
Questions and answers
- Q: Have you thought about upstreaming EAT?
- A: Yes, but I haven't yet completed the copyright paperwork.
- S: Look into it, I think it would be great to have a better implementation of a terminal OOTB!
- A: Yes, but I haven't yet completed the copyright paperwork.
- Q: Very impressive! What lessons did you learn while developing
EAT?
- A:I learned how to optimize Elisp code, and also how terminals work actually. And also process handling in Elisp.
- Q: How long did it take you to develop EAT to this point?
- A:It took around 5 months to make it working at bare minimum.
- Q: Did you have any experience with terminal emulation
before working on EAT?
- A:Not much really. I mean I knew how terminals worked but I didn't know the escape sequences.
- Q: Did you have any experience with terminal emulation
before working on EAT?
- A:It took around 5 months to make it working at bare minimum.
- Q:Impressive work; I look forward to trying it. What did you want
that Vterm did not provide? I think I'll try it today.
- A:The keybindings, specially. And also I wanted Eshell terminal emulation.
- Q: Is Elisp native-compilation what allows EAT to peform as well as
or better than Vterm, or is EAT even that fast with just
byte-compilation?
- A:I use native-compilation. But Eat is still quite a few times faster than Term mode when byte-compiled.
- Q: Should it work on Emacs 28.1?
- A:Yes.
- Q: What does EAT do differently than other terminal emulators that
allows it to perform so well?
- A:I don't really know quite clearly. At the time I implemented the main code, I had plenty of time. I did profiling and tried various implementations to do the same thing.
- Q: what sparked your interest in Emacs, considering its often
perceived as outdated, and how do its powerful capabilities remain
relevant today?
- A: First of all, it's free software, I have the freedom. And the IDEs I used to use were resource hogs, so needed something lightweight. And, after I started using Emacs, I discovered how powerful it actually is. Emacs is itself a programming platform, so you can make literally anything with it.
- Q: have you thought about making EAT work with shell-mode?
- A: Yes, I have considered integrating with shell-mode/Comint but it doesn't work, they need the terminal text to be mutable and Eat doesn't support that. So I have implemented "line mode," an input mode similar to shell-mode.
- Q: did the talk show how to show sixel?
Notes
- I found out about EAT a while ago and was excited to find out that it works so well! Thank you for your great work!
- akib, truly impressive!
- :clap::clap::clap::clap::clap::clap:
- ¡Muy bueno!
- I use eat, and I have almost replace terminal (bash/zsh) with eshell paired with eat
- i use eat but i don't really have anything to say cuz i don't use the CLI nearly as much anymore since learning more emacs stuff. but i still think eat is awesome cuz it is really fast for when i do need it
- I'll be looking into eat more, thanks for the talk!
- demonstrating sixels would have been a surprise for some...
- eat is very easy to try out compared to vterm since there's no foreign code involved
- I was stunned at how fast eat is!
- even without native-comp, it's pretty fast
- eat is the apple equivalent of terminal emulators in emacs: It just works!
- best of both world is, eshell paired with eat
- http://yeti.freeshell.org/tmp/20231203-155213__emacs_eshell_eat__showing_xkcd_378_via_sixels.png
- I usd img2sixel wnd some awk glue
- imagemagick can also convert to sixel
- I usd img2sixel wnd some awk glue
- you're the one who helped me with eat and the dumb term line for .zshrc so ty!
- speaker: yes, i have considering integrating with shell-mode/comint but it doesn't work, they need the terminal text to be mutable and eat doesn't support that so i have implemented "line mode," input mode similar to shell mode
Transcript
[00:00:00.000] Intro
Hello everyone. Welcome to my talk. I am Akib Azmain Turja and my talk is titled "Eat and Eat-powered Eshell: Fast, featureful terminal inside Emacs."
[00:00:15.440] Benchmarking
So I just claimed that Eat is a fast terminal emulator. Let me show you that. I will print a 1-megabyte sized file in the terminal using this command. It takes 0.76 seconds. Now let's benchmark term-mode. I will be in term -mode. I use the same command, and it's clearly the loser. It took 12 seconds, more than an order of magnitude slower. Let's also measure the speed of return. And it took 0.79 seconds. But this is actually a little bit slower than Eat. Why? That shouldn't happen. Anyway, hopefully that shows how fast Eat is.
[00:01:49.720] Running programs
So let's run some extra programs in Eat, like top. You can also run htop or even btop. There is a fancy version of top. And obviously you can run Emacs in it. There is mouse support, and there is true color support. You can show any color in the terminal as long as your main display supports it.
[00:02:47.080] Shell integration
And then there is shell integration. For example, directory tracking. Like, I can switch to some other directory and Emacs follows the shell directory.
[00:03:11.920] Prompt annotation
Then there is prompt annotation, this column. These zeros indicate that the command has executed successfully. Then you can navigate between commands like this.
[00:03:37.680] Message passing
There is message passing. By message passing, I mean sending something from the terminal to the host Emacs. By host Emacs, I mean Emacs running the terminal. For example I can say "hi" and it's showing "hi" in this echo area of my Emacs.
[00:04:03.520] Shell integration
Then let's show you the killer feature of Eat, Eat's shell integration. You can run any program in it. For example: top, btop, and obviously Emacs itself.
[00:04:52.160] Input modes
So let's discuss how to use Eat. There are four input modes. The first one is semi-char mode. That is the default mode. This is like vterm. All keys are the same to your terminal except these keys: C-c, C-x, C-g, M-x, etc. And then there is char-mode, where all keys are same to your terminal, except this M-RET key which takes you back to the semi-char mode. Then there is Emacs mode where you can select and copy from the terminal buffer. And finally, there is line mode. You can use it to use your terminal like a comint buffer. All these input modes are available in both Eat and eat-eshell mode, except this line mode-- it's only available on Eat. By "on Eat", I mean the terminal you get by this eat command. By eshell, I mean when eat-eshell integration is enabled inside the eshell buffer.
[00:06:33.760] Documentation
There is an info manual, And also the README is quite informative for you to get started. If you hit any problem, there is a dedicated chapter for debugging that, a common problems chapter. If your problem is still not fixed, please report it to me. This helps me improve it for everyone. When you report, please read this chapter so that you can make a better bug report. I am really looking forward to how people use it in their workflow. I am excited about that. Hopefully you enjoyed my talk. That was all. Enjoy EmacsConf. Goodbye.
Questions or comments? Please e-mail akib@disroot.org