[net.unix-wizards] EMACS control character warning

minow (05/29/82)

Recently, I have been using a version of EMACS for Unix systems
that uses CTRL/S for "search" and CTRL/Q for "quote next character"

Please be warned that many terminals, such as the VT52 and VT100
use these for host->terminal flow control.  (CTRL/S stops the
host and CTRL/Q restarts it).  This can lead to strange, irreproducable,
editor glitches.

While some versions of EMACS allow redefinition of the control characters,
few novice users -- such as myself -- would dare such an advanced
undertaking.


Martin Minow
decvax!minow

jcwinterton (06/02/82)

Further to Martin Minow's comments on ^Q and ^S, if you are using a value added
network then ^P may also be "unavailable".  The solution is to remove the binding
for these keys.  If that is considered to be too advanced, then, perhaps we
should just stick to "glass teletypes".  I use esc-s, esc-^ and esc-p for
the appropriate functions.
One of the groups here is actually designing a screen editor which takes
over the FUNCTION keys on terminals that have them.  I consider this an
invasion of privacy (I use my function keys for neat stuff like talk to my
network box, etc.)
*sigh*
John Winterton.

mark@Berkeley@sri-unix (06/11/82)

From: mark at Berkeley (Mark Horton)
Date: 31-May-82 21:00:42-EDT (Mon)
Re:
	Recently, I have been using a version of EMACS for Unix systems
	that uses CTRL/S for "search" and CTRL/Q for "quote next character"

	Please be warned that many terminals, such as the VT52 and VT100
	use these for host->terminal flow control.  (CTRL/S stops the
	host and CTRL/Q restarts it).  This can lead to strange,
	irreproducable, editor glitches.

There are actually zillions of terminals out there that can use
XON/XOFF handshaking.  Practically every new terminal being made does
this.  You can argue the merits of the particular protocol all you
want, but the facts are that this one is being rapidly made the
de-facto standard, and it works even over phone lines without any
special smarts in the tty drivers.  (That is, the system being called
doesn't care if the caller is a computer or a terminal, as the protocol
works with both.) Practially every terminal can shut off this
handshaking (the h19 is the main exception) if the system is willing to
add appropriate "worst case" padding.  My experience has been that any
terminal with a buffer does much better with xon/xoff than with
worst-case padding.

Four years ago, vi bit the bullet and moved its control S and Q
commands to other keys.  This allowed terminals using xon/xoff
handshaking to run in that mode while in a screen editor.  Recently the
Rand Editor has also moved away from these two keys.  The major editor
that still uses them for commands is the EMACS family.  (There must be
10 or 20 implementations of EMACS by now.)  Certainly it is painful to
move commands with sensible mnemonics like "search" and "quote", but
experience has shown that the pain quickly fades as users get used to
the new syntax.  (There is the usual griping about non-upward compatibility
and how wonderful it was before associated with ANY change.)

I have brought this up before.  Usually when I do I am immediately
engulfed in flames from RMS about "losing networks that don't allow
transparent connectiions".  While it certainly would be nice if all
networks allowed transparent connections, this has nothing to do with
the fact that most terminals now need xon/xoff support to run at full
speed.

I think it's clear that new editors should avoid use of ^S and ^Q as
command characters.  (They should also avoid escape, since most arrow
and function keys transmit escape sequences, causing an ambiguity.
EMACS will probably never understand arrow keys, and thus will be harder
to learn than it need be, because it uses escape so heavily.)
I also would like to see EMACS move away from these keys.  (I know from
experience that it won't, but you should at least all be aware of
what you're missing because of this.)

	Mark Horton

z (06/11/82)

One compromise is to use terminals which have settable XON/XOFF
characters, such as the Ann Arbor Ambassador.  Although my EMACS
normally runs in raw mode, if it's running on an Ambassador at
19200 baud, it runs in CBREAK mode and uses ^^/^@ for flow control.
These characters seem to impact the EMACS character set the least,
and I simply move the Set Mark and Prefix Control commands to function
keys.

Also, I don't know about other EMACSes, but function keys which generate
escape sequences pose no problem for mine due to the dynamic rebinding
feature.  Escape is rebound from Prefix-Meta to Prefix Character for
Function Keys, and the various function keys are then just subcommands
of this prefix.  One of these function keys is typically used as a
Meta key.  One of our most popular terminals here is the Zenith, and 
EMACS uses all of its function keys, both shifted and unshifted; we've
even had special EMACS keycaps made up for these terminals.

davidson (06/11/82)

Just to correct an error in Mark Horton's article on EMACS, the
EMACS I use (Gosling's) understands vector keys just fine.  I use
an H19, and have bound all of my escape-prefixed function keys to
useful commands.

Greg Davidson

ziegler (06/14/82)

Two points about EMACS and xon/xoff:

First, the trouble with VT100s and VT52s is that in certain configurations
they are NOT ASCII TERMINALS.  This means that they cannot transmit and
receive all 128 ASCII characters properly.  We had a similar problem with
these beasts here, and after a lot of hassling we found a way around it.  I
will agree with you, however, that it would be nice if the editor didn't
require that.  One of the nice things about EMACS is the fact that you can
get around such problems.  I still see it as a terminal/transmission problem,
not an editor problem.  Flow control does not belong at the application
layer.

Second, it is because EMACS uses the escape character the way it does that
I am able to use the arrow keys on my terminal (an HP125 - a 2601 based
terminal with an extra Z80 and CP/M).  In fact, I have set up EMACS macros
to use all of the screen editting keys on the keyboard, including such
functions as insert/delete character/line, next/previous page, home up/down,
roll up/down, and the usual assortment of arrow keys.  These keys all transmit
escape sequences, which made it very easy to use them in EMACS.  In fact, I
have also written macros to use the arrow and function keys on VT100s, despite
SSSSSSSSSSSSSSSSSSSSSSSS  This fact makes it easier to learn
EMACS, not harder, since I use keys that are clearly labeled as to their
purpose rather than slightly mmnemonic control or escape sequences.

I don't want to spawn a debate about the good and bad points of EMACS or any
other screen editor; I simply find EMACS to be a fine tool to use because it
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS

	Joe Ziegler
	...ihnss!houxf!ziegler
	BTL LZ 3F-308
	(201) 576-3533

Brian@sri-unix (06/27/82)

Date: 11 June 1982 08:19-EDT
For what it's worth, my Unix is running an EMACS-like editor (but not
true, extensible, etc) which avoids ^S and ^Q.  The really painful part
is that all the plausible keys to use instead already had other meanings,
so we mapped ^S to ^\ and ^Q to ^^ (which is ^` or ^~ if you're using
a VT-100).  Our users live through it.  (There is a version of this
editor, edt, on the forthcoming Usenix distribution, although since we
sent it in, the author has added 2-window mode and multiple buffers and
stuff like that -- advt.)  (The author, by the way, is Jonathan Payne,
a high school senior.  Very impressive work.)

If you have a VT-100 style (a/k/a ANSI) terminal, you don't have to
avoid ESC to get arrow keys, all you have to do is avoid ESC [ as a
command sequence.  edt uses the usual EMACS ESC commands and also
understands VT-100 arrow keys.

I mention the particular mapping we use because it would be nice to have
a universal standard and it would, I agree, be nice if the standard
avoided ^S/^Q.  It is truly wonderful to me that I can go from MIT with
the real EMACS to my high school with edt and even to somebody's Z80
running MINCE and still be able to edit text.  (Although it would sure
be nice if MINCE did the right thing with numeric arguments to ^K.)

edt, by the way, uses termcap and all that good stuff.