Emacs and redisplay on the terminal (TTY). “Because the true color of computing is phosphorescent green on black.”

(Date: 20 September 2024)

Summary

I select highlights of jwz’s previous post about a physical terminal. This provides motivation for studying the Emacs display engine in a future article, with associated optimizations.

Ann Arbor terminal

Jamie Zawinski wrote a 2016 blog post on reconnecting his physical terminal from 1982–83, by using a Raspberry Pi.

Here are some excerpts.

Look at the sustain on that phosphor. Just look at it! The video is a little long, but it’s moody.

Now, this is a pretty sweet terminal, because as you see, it’s portrait mode. Most terminals of this 1982 vintage had 80x24 screens. This bad boy does a glorious 80 columns by 60, sixty rows! You could emacs for days on this thing, it was glorious.

I did a significant portion of my Emacs development on this terminal. When I was working from home, this is what I worked on. I think I wrote BBDB and the byte-compiler on this thing. (...) At one point, I built a 50’ serial cable so that I could drag the terminal out onto the back deck and work outside.

Updating the screen efficiently is effectively a compiler-optimization problem. You know what’s on the screen right now, and what you want it to be, and you have to get from here to there using the absolute minimum number of bytes, because each of those bytes takes an amount of time that can actually be perceived by the user. Naïve programs might just do the obvious thing, and when they want to put text on line 3, they move to line 3 and draw the text. But if you were running a sophisticated lisp system that happened to have a text editor inside it, nothing so simple would stand. It would run the permutations and figure out that these two commands would both work, but this one was shorter. Or things like: if I scroll three lines, mark a rectangle, and then indent that rectangle by 5 spaces, I only have to send an additional 17 bytes to finish up, instead of 480 to do the whole thing. The text-mode display optimization module in Emacs was truly a "Here Be Dragons" situation.

Jamie closes with:

Sometimes people ask me why my web sites use those colors. This is a thing that people sometimes ask.

See the original post at jwz.

Green phosphor theme

Incidentally, in Emacs (GUI) there is a theme written by Adam Alpern, who describes it as

A retro color theme for Emacs. Because the true color of computing is phosphorescent green on black.

It available on the MELPA package archive, at https://melpa.org/#/green-phosphor-theme. See also https://emacsthemes.com/themes/green-phosphor-theme.html, and the code at https://github.com/aalpern/emacs-color-theme-green-phosphor

Then load with (load-theme 'green-phosphor t).

TTYs

For further details on TTYs, See: Linus Akesson. “The TTY demystified”, 2008, at https://www.linusakesson.net/programming/tty/

Conclusion

In a future article I will delve into Emacs redisplay internals.