EmacsOnTerminal

This is a node about running Emacs on so called “dumb terminals”. Well, they’re not that dumb really, because they can do all sorts of things by themselves, and most people emulate these things on a daily basis.

Most of this applies to unixy systems, like the GnuIsNotUnix, often erroneously called Linux. EmacsOnVMS is also a candidate topic here, and maybe EmacsForOSTwo, but other systems are not likely to be accessed via a terminal.

There’s a lot of goodies for terminals at http://vt100.net.

The most basic variable on the unix-machines is TERM, and it gets it’s default from the configuration file of mother of all processes, the init. This file is usually called “/etc/inittab”. The value of this variable should obviously match the capabilities of you terminal. If in doubt, “vt220” covers most of the terminals, and “vt100” almost all. Other variables for shells of the sh-family are COLUMNS and LINES, and these should match your terminals settings too. I won’t get into line-characteristics here, like speed, number of data and stop bits.

When Emacs starts, it tries to load a library called “term/value_of_term”, f.ex. “term/vt420”. These usually set quite decent defaults.

You do want to have hardware flowcontrol, and turn it on from the terminal itself, and for the getty process too which is the thing that initializes the terminal line. Well, you can use stty(1) too, to tweak you serial line. So you’ll propably wan’t to have a null-modem cable, or real modems if you’re a bit further away, or got some extras lying about.

The flowcontrol is crucial at speeds above 9600bps. The XON/XOFF protocol, which sucks anyway, might interfere with Emacs’ C-s and C-q events, so you do want RTS/CTS. The library flow-ctrl provides some convenience features, most notably the command enable-flow-control which also remaps these keys. Other ways to handle use of XON/XOFF include using the unix command stty -ixon or (set-input-mode t nil t) from Emacs. Either way, no matter what your setting will be, you will miss the command recenter that will re-draw the screen. By default it’s bound to C-l.

Notes about certain terminals

DEC's VT-series of terminals

Terminals by Digital Equipment Corporation, or |d|i|g|i|t|a|l| are common, and often emulated. Maybe the most common terminal mode of all is the vt100, and also vt101, vt102 and vt220. Emacs handles there terminals quite well.

Most of the special keys work by default, tho there’s some quirks. At least the VT420, like many other DEC terminals don’t have a proper “ESC” key, but the sequence can be generated with C-3 or with C-[. Emacs’ term/ libraries also map the f11 key as an additional ESC for some DEC terminals (vt220, vt320 and vt420 at least), so there’s three to choose from.

Make sure you use the “vt420 mode, 7bit controls”, not with 8bit controls. These 8bit controls are not defined, and rarely used with unixy computers, which is bit of a pity…

The Alt key doesn’t work as expected.

Certain values for the keyboard type from the terminal’s menus (f.ex. “Finnish keyboard”) make the S-3 produce section-symbol “§”, and not the hash-symbol “#” one expects. The compose character -key is used to compensate this, by compose + +.

The terminal’s keyboard also has two modes, “typewriting keys” and “data processing keys”. For instance the former allow the keys left of RET to be used for scandinavian chars with a finnish keyboard, the latter enables the curly braces, brackets and others on the same keys. This is a bit of a nuisance, but again, can be compensated for with the compose key.

Success stories

tekonivel's DEC VT420

tekonivel occasionally uses a DEC VT420 over a null-modem cable to a GnuIsNotUnix system, and it works just fine. Though the speed is set quite low, to 9600, it’s still usable, as Emacs wisely updates only the parts of screen that have changed. The VT420 is used in a mode with 132 columns and 48 rows, page-length also set to 48 to get fullscreen pages. The cable is simple, and doesn’t provide hardware flowcontrol. There’s actually none in use, because the speed is low enough.

Actually the terminal is used in VT220 emulation mode, because the “vt420” termcap entry doesn’t happen to be installed on one of the machines it’s used for. vt220 mode is the default for the line in /etc/inittab of the host computer, as well as for the terminal itself.

The Alt key doesn’t work at all, which is a bit of a pain in the neck.