1.8 Use With Terminals

  • 1.8.1 Terminal Initialization
  • 1.8.2 Terminal Input
  • 1.8.3 Terminal Redisplay
  • Hemlock can also be used with ASCII terminals and terminal emulators. Capabilities that depend on X windows are not available, but nearly everything else can be done. [annotate]

    1.8.1 Terminal Initialization

    For best redisplay performance, it is very important to set the terminal speed: stty 2400 Often when running Hemlock using TTY redisplay, Hemlock will actually be talking to a PTY whose speed is initialized to infinity. In reality, the terminal will be much slower, resulting in Hemlock's output getting way ahead of the terminal. This prevents Hemlock from briefly stopping redisplay to allow the terminal to catch up. See also Scroll Redraw Ratio. [annotate]

    The terminal control sequences are obtained from the termcap database using the normal Unix conventions. The "TERM" environment variable holds the terminal type. The "TERMCAP" environment variable can be used to override the default termcap database (in "/etc/termcap"). The size of the terminal can be altered from the termcap default through the use of: stty rows height columns width [annotate]

    1.8.2 Terminal Input

    The most important limitation of a terminal is its input capabilities. On a workstation with function keys and independent control, meta, and shift modifiers, it is possible to type 800 or so distinct single keystrokes. Although by default, Hemlock uses only a fraction of these combinations, there are many more than the 128 key-events available in ASCII. [annotate]

    On a terminal, Hemlock attempts to translate ASCII control characters into the most useful key-event: [annotate]

    Since terminals have no meta key, you must use the Escape and C-Z modifier-prefix key-events to invoke commands bound to key-events with the meta bit or meta and control bits set. ASCII terminals cannot generate all key-events which have the control bit on, so you can use the C-^ modifier-prefix. The C-c prefix sets the hyper bit on the next key-event typed. [annotate]

    When running Hemlock from a terminal ^\ is the interrupt key-event. Typing this will place you in the Lisp debugger. [annotate]

    When using a terminal, pop-up output windows cannot be retained after the completion of the command. [annotate]

    1.8.3 Terminal Redisplay

    Redisplay is substantially different on a terminal. Hemlock uses different algorithms, and different parameters control redisplay and screen management. [annotate]

    Terminal redisplay uses the Unix termcap database to find out how to use a terminal. Hemlock is useful with terminals that lack capabilities for inserting and deleting lines and characters, and some terminal emulators implement these operations very inefficiently (such as xterm). If you realize poor performance when scrolling, create a termcap entry that excludes these capabilities. [annotate]

    Scroll Redraw Ratio  (initial value nil) [Variable]
              

    This is a ratio of "inserted" lines to the size of a window. When this ratio is exceeded, insert/delete line terminal optimization is aborted, and every altered line is simply redrawn as efficiently as possible. For example, setting this to 1/4 will cause scrolling commands to redraw the entire window instead of moving the bottom two lines of the window to the top (typically 3/4 of the window is being deleted upward and inserted downward, hence a redraw); however, commands like New Line and Open Line will still work efficiently, inserting a line and moving the rest of the window's text downward. [annotate]

    [annotate]