Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ucbvax!decwrl!labrea!rutgers!ucla-cs!minnie!kennel
From: kennel@minnie.cognet.ucla.edu (Matthew Kennel)
Newsgroups: comp.sys.mac
Subject: Re: What a joke Emacs is (CTRL-Q/S controversy)
Message-ID: <14243@shemp.CS.UCLA.EDU>
Date: 9 Jul 88 01:48:48 GMT
References: <3601@csvax.liv.ac.uk> <23571@teknowledge-vaxc.ARPA> <3918@csvax.liv.ac.uk>
Sender: news@CS.UCLA.EDU
Reply-To: kennel@minnie.UUCP (Matthew Kennel)
Organization: none
Lines: 105

In article <3918@csvax.liv.ac.uk> sqrkl@csvax.liv.ac.uk writes:
>In article <23571@teknowledge-vaxc.ARPA>,
> mkhaw@teknowledge-vaxc.ARPA (Mike Khaw) writes:
>> 
>> How fast does it (Maculator) go WITHOUT xon/xoff?  Emacs uses ^S for
>> "incremental search", and ^Q for "quote" (to allow you to insert control
>> chars into your buffer).
>> 
>I find it amazing that an editor (does Emacs deserve such an accolade ?)
>in these so-called modern times actually uses CTRL-Q and CTRL-S as commands.
>This has me dumbfounded (for a change !) and it serves anyone right who
>uses Emacs. All minis/mainframes I know of (no doubt there are exceptions)
>support XON/XOFF as a matter of course and you WOULD be foolish to run a
>terminal emulator at high speeds without XON/XOFF active.
>
>Richard K. Lloyd,       ****** This is a VAX 11/780 running VAX/VMS V4.5 ******

I quote from the INSTALL file of our gnu emacs distribution:

---begin quotation---
C-s/C-q flow control is bad for Emacs editors because it takes away
C-s and C-q as user commands.  Since editors do not output long streams
of text without user commands, there is no need for a user-issuable
"stop output" command in an editor; therefore, a properly designed
flow control mechanism would transmit all possible input characters
without interference.  Designing such a mechanism is easy, for a person
with at least half a brain.

There are three possible reasons why flow control could be taking place:

  1) Terminal has not been told to disable flow control
  2) Insufficient padding for the terminal in use
  3) Some sort of terminal concentrator or line switch is responsible

First of all, many terminals have a set-up mode which controls
whether they generate flow control characters.  This must be
set to "no flow control" in order for Emacs to work.  Sometimes
there is an escape sequence that the computer can send to turn
flow control off and on.  If so, perhaps the termcap `ti' string
should turn flow control off, and the `te' string should turn it on.

Once the terminal has been told "no flow control", you may find it
needs more padding.  The amount of padding Emacs sends is controlled
by the termcap entry for the terminal in use, and by the output baud
rate as known by the kernel.  The shell command `stty' will print
your output baud rate; `stty' with suitable arguments will set it if
it is wrong.  Setting to a higher speed causes increased padding.  If
the results are wrong for the correct speed, there is probably a
problem in the termcap entry.  You must speak to a local Unix wizard
to fix this.  Perhaps you are just using the wrong terminal type.

For terminals that lack a "no flow control" mode, sometimes just
giving lots of padding will prevent actual generation of flow control
codes.  You might as well try it.

If you are really unlucky, your terminal is connected to the computer
through a concentrator which sends flow control to the computer, or it
insists on sending flow control itself no matter how much padding you
give it.  You are screwed!  You should replace the terminal or
concentrator with a properly designed one.  In the mean time,
some drastic measures can make Emacs semi-work.

One drastic measure to ignore C-s and C-q, while sending enough
padding that the terminal will not really lose any output.
Ignoring C-s and C-q can be done by using keyboard-translate-table
to map them into an undefined character such as C-^ or C-\.  Sending
lots of padding is done by changing the termcap entry.

An even more drastic measure is to make Emacs understand flow control.
Do (set-input-mode nil t).  Emacs will then interpret C-s and C-q as
flow control commands.  You will lose the ability to use them for
Emacs commands.  Also, as a consequence of using CBREAK mode, the
terminal's Meta-key, if any, will not work, and C-g will be liable to
cause a loss of output which will produce garbage on the screen.  You
can use keyboard-translate-table to map two other input characters
(such as C-^ and C-\) into C-s and C-q, so that you can still search
and quote.

I have no intention of ever redisigning the Emacs command set for
the assumption that terminals use C-s/C-q flow control.  This
flow control technique is a bad design, and terminals that need
it are bad merchandise and should not be purchased.  If you can
get some use out of GNU Emacs on inferior terminals, I am glad,
but I will not make Emacs worse for properly designed systems
for the sake of inferior systems.

* Control-S and Control-Q commands are ignored completely.

For some reason, your system is using brain-damaged ^S/^Q flow
control despite Emacs's attempts to turn it off.  Perhaps your
terminal is connected to the computer through a concentrator
that wants to use flow control.

You should first try to tell the concentrator not to use flow control.
If you succeed in this, try making the terminal work without
flow control, as described in the preceding section.

If that line of approach is not successful, map some other characters
into C-s and C-q using keyboard-translate-table.  I suggest C-^ and
C-\.
----end quotation-----

"So, there it is."

matt k
(kennel@cognet.ucla.edu)