The Plan 9 windowing system is called 81/2, since it was the Eight and a half'th windowing system that Rob Pike had written. To create a new window, you select New from the right button menu, and sweep out the window you want. That window then runs a shell (rc, discussed below).
What is unusual about the windows in 81/2 is that you can edit the text directly in the window. Thus, if you make a typing error in a command, you fix the error, select the entire line, and resubmit it. This obsoletes the need for built-in command history as found in current Unix shells, such as ksh, bash and tcsh.
Furthermore, windows provide more complicated text editing capabilities. By pressing the ESCAPE key, the window goes into “hold mode”. All text is kept in the window. It is not sent to the program running in the window until the ESCAPE key is hit again, leaving hold mode. Hold mode is indicated by an extra white border inside the window, and a larger, white arrow for the mouse cursor.
You might use this, for example, when sending mail to someone. Run the Mail command, and then go into hold mode. Type in, edit, and rearrange your letter to your hearts content. Then leave hold mode, and out goes your mail to the Mail program.
Finally, by default, 81/2 windows do not scroll. Instead, text just buffers up inside them until you are ready to look at it. The down-arrow key on the keyboard allows you to quickly move through the buffered text. You can use the button 2 menu to change the behavior of the window so that it does scroll. The non-scrolling mode is a feature; it obviates the need for pager programs like more, pg, and less.
The Unix program that emulates 81/2 windows is called 9term. 9term was written by Matty Farrow, at the University of Sydney, in Australia. It adds an additional library, libtext, on top of libframe and libXg. 9term is both small and fast. On a Sun SPARCstation LX, 9term starts almost instantly, while an xterm can take several seconds to start up, noticeably longer.
Besides hold mode described above, 9term provides cut and paste editing and the ability to search backwards or forwards in the window for a particular piece of text (whatever is currently selected). 9term also uses the up-arrow key to allow you to go backwards in the window, something that must be done with the mouse in 81/2.
The 9term interface is consciously similar to that of sam. Button 1 in both programs selects text, button 2 supplies the editing menu, and button 3 provides the control menu. Double-clicking button 1 at the end of a line selects the whole line, and double-clicking in the middle of a word selects the word. Finally, in both programs, menus “remember” the last command issued. Thus, the next time you call up a menu, the default action is to do what you did last time, which is often what you want to do.
Having the identical interface makes using your system much easier; you don't have to mentally “switch gears” when moving from one window to the next: your mouse and keyboard work the same way, no matter what.
9term is fast because it is simple. Unlike xterm, it is not emulating a real terminal (or two or three), trying to interpret and process escape sequences. This means, for example, that you can't run vi or emacs inside a 9term window. On the other hand, why would you want to? sam is considerably more powerful than vi, and much easier to learn than Emacs. My intent is not to start Yet Another Religious Editor War. Rather, the philosophy is that 9term doesn't have to be complicated to support screen editors, since a powerful editor, sam, is already available.
In the same directory as the 9term distribution there is a tar file with a large set of Unicode fonts for use with X. I particularly like the pelm.latin1.9 font.
The sidebar describes where to get 9term and the Unicode fonts.
In next month's conclusion, we'll discuss the shells to run inside 9term, and the 9wm window manager that completes the 81/2 emulation.
Arnold Robbins (firstname.lastname@example.org) is a professional programmer and semi-professional author. He has been doing volunteer work for the GNU project since 1987 and working with Unix and Unix-like systems since 1981.