[comp.emacs] GNU Emacs and flow control

jr@LF-SERVER-2.BBN.COM (John Robinson) (11/30/87)

Following is an attempt at a brief note to explain how to cope with
flow control in GNU Emacs.  I plan to keep this around to send to
users who ask (frequently) "how to I get Emacs to do flow control?"  I
solicit your comments/additions/etc.

/jr
jr@bbn.com or jr@bbn.uucp
--------
GNU emacs (version 18.48 and later) provides several options for
coping with terminals or front-ends that insist on using flow control
characters.  Listed in estimated order of preference.

1.  Have Emacs run in CBREAK mode with the kernel handling flow
control.  Issue (set-input-mode nil t) from .emacs.  It is now
necessary to find other keys to bind to the commands isearch-forward
and quoted-insert.  Traditional nominees are C-^ and C-\.  There are
two ways to get this effect:

  1a.  Use the keyboard-translate-table to cause C-^ and C-\ to be
  received by Emacs as though C-S and C-Q were typed.  Emacs
  (except at its very lowest level) never knows that the characters
  typed were anything but C-S and C-Q, so the use of these keys inside
  isearch still works - typing C-^ while incremental searching will
  move the cursor to the next match, etc.

  1b.  Simply rebind the keys C-^ and C-\ to isearch-forward and
  quoted-insert.  To get continued searches inside isearch it is also
  necessary to set search-repeat-char to C-^.

2.  Don't use CBREAK mode, and global-unset-key the keys C-S and C-Q.
The problem with this is that whatever sent the flow control
characters is apt to be falling behind the characters being sent to
it, and so what finds its way to the terminal screen will not in
general be what is intended.  It will be still be necessary to find
other keys to bind to isearch-forward and quoted-insert; see 1a and 1b
above.

Note that, if the terminal is the source of flow control characters
and kernel flow control handling is enabled, it will not in general be
necessary to send padding characters as specified in a termcap or
terminfo entry.  It may be possible to customize a termcap entry to
provide better Emacs performance on the assumption that flow control
is in use.  This effect can also be simulated by announcing (with
stty(1) or its equivalent) that the terminal is running at a very slow
speed, provided the terminal is not directly wired to the host.