Next: , Previous: , Up: System Interface   [Contents][Index]


58.10 Flow Control

This section attempts to answer the question “Why does SXEmacs choose to use flow-control characters in its command character set?” For a second view on this issue, read the comments on flow control in the sxemacs/INSTALL file from the distribution; for help with Termcap entries and DEC terminal concentrators, see sxemacs/etc/TERMS.

At one time, most terminals did not need flow control, and none used C-s and C-q for flow control. Therefore, the choice of C-s and C-q as command characters was uncontroversial.

XEmacs, for economy of keystrokes and portability, used nearly all the ASCII control characters, with mnemonic meanings when possible; thus, C-s for search and C-q for quote.

Later, some terminals were introduced which required these characters for flow control. They were not very good terminals for full-screen editing, so XEmacs maintainers did not pay attention. In later years, flow control with C-s and C-q became widespread among terminals, but by this time it was usually an option. And the majority of users, who can turn flow control off, were unwilling to switch to less mnemonic key bindings for the sake of flow control.

So which usage is “right”, XEmacs’s or that of some terminal and concentrator manufacturers? This question has no simple answer.

One reason why we are reluctant to cater to the problems caused by C-s and C-q is that they are gratuitous. There are other techniques (albeit less common in practice) for flow control that preserve transparency of the character stream.

Note also that their use for flow control is not an official standard. Interestingly, on the model 33 teletype with a paper tape punch (which is very old), C-s and C-q were sent by the computer to turn the punch on and off!

As X servers and other window systems replace character-only terminals, this problem is gradually being cured. For the mean time, (S)XEmacs provides a convenient way of enabling flow control if you want it: call the function enable-flow-control.

Command: enable-flow-control &optional argument

This function enables use of C-s and C-q for output flow control, and provides the characters C-\ and C-^ as aliases for them using keyboard-translate-table (see Translating Input).

With optional argument argument (interactively the prefix argument), enable flow control mode if argument is positive; else disable it.

You can use the function enable-flow-control-on in your init.el file to enable flow control automatically on certain terminal types.

Function: enable-flow-control-on &rest termtypes

This function enables flow control, and the aliases C-\ and C-^, if the terminal type is one of termtypes. For example:

(enable-flow-control-on "vt200" "vt300" "vt101" "vt131")

Here is how enable-flow-control does its job:

  1. It sets CBREAK mode for terminal input, and tells the operating system to handle flow control, with (set-input-mode nil t).
  2. It sets up keyboard-translate-table to translate C-\ and C-^ into C-s and C-q. Except at its very lowest level, SXEmacs never knows that the characters typed were anything but C-s and C-q, so you can in effect type them as C-\ and C-^ even when they are input for other commands. See Translating Input.

If the terminal is the source of the flow control characters, then once you enable kernel flow control handling, you probably can do with less padding than normal for that terminal. You can reduce the amount of padding by customizing the Termcap entry. You can also reduce it by setting baud-rate to a smaller value so that SXEmacs uses a smaller speed when calculating the padding needed. See Terminal Output.


Next: , Previous: , Up: System Interface   [Contents][Index]