Path: utzoo!attcan!uunet!husc6!rutgers!tut.cis.ohio-state.edu!bgsuvax!denbeste
From: denbeste@bgsuvax.UUCP (William C. DenBesten)
Newsgroups: comp.sys.mac
Subject: Re: Defence against a VT100 Maculator slur...
Message-ID: <2531@bgsuvax.UUCP>
Date: 5 Jul 88 14:15:10 GMT
References: <26472@bbn.COM>
Organization: Bowling Green State University B.G., Oh.
Lines: 63

Someone wrote:
> I am new to this mac world.  I downloaded the VT100 emulator posted
> on this net a while ago and I tried it at home.  It seemed no problem
> until I ran emacs.  My screen was completely garbaged after I started
> the emacs.

In article <26472@bbn.COM>, levin@bbn.com (Joel B Levin) writes:
> All the versions of EMACS I have used on host computer systems do not
> like XOFF/XON; they actually use ^S and ^Q as command characters and
> try to fix slow the output to the screen by padding with invisible
> characters (which, needless to say, does not help the problem of a
> slow character handler) or maybe in some cases by actually pausing to
> let the screen catch up.  This kind of behavior can be really painful,
> of course.  An emulator which is fast enough for EMACS really has to
> be fast enough without flow control; and the combinations of the
> various EMACS (Ultrix, Sun, TOPS-20) with the Mac VT100 emulator I use
> work fine.

The solution to this problem is to rebind keys so that emacs
effectively ignores xon/xoff, and move the commands that were on those
keys to a different key.  At my site, we have set up a site-wide
initialization file for emacs that does just that.  If you want to do
it for yourself, put the following in your .emacs file.  If you have
none, create a file, ~/.emacs and put the following in it:

8<------------------------------ Cut Here ------------------------------>8
;;;	$Source: /u1/third_party/gnuemacs.v17/lisp/term/RCS/xon.el,v $
;;;	$Author: rlk $
;;;	$Header: xon.el,v 1.1 86/01/29 14:51:49 rlk Exp $


(set-input-mode nil t)
(setq keyboard-translate-table
      "\000\^a\^b\^c\^d\^e\^f\^g\^h\^i\^j\^k\^l\^m\^n\^o\^p\^q\^r\^s\^t\^u\^v\^w\^x\^y\^z\033\^q\035\^s")
(setq losing-keyboard t)

(defun help-for-losing-terminal ()
  "Describe losing flow-controlled terminals."
  (let ((buffer (current-buffer)))
    (pop-to-buffer (get-buffer-create "*Help*"))
    (insert
"The terminal you are using reserves the C-s and C-q characters for a special
use, known as auto-Xon/Xoff flow control, and thus you cannot use these
characters for any purpose, and neither can Emacs.  Therefore, we have to
replace any key combinations (such as C-s and C-x C-q) with new key
combinations not using these characters.

We have chosen the characters C-~ (or C-^ on some terminals) and C-\\ 
(control-backslash) to directly replace these characters, to make the
conversion easier.  Very few commands are bound to keystrokes using these
two characters, thus this should not be too much of a problem.  If you
accidentally type C-s by mistake your terminal will freeze and you will have
to type C-q to unfreeze it.

For example, the command to search forward, which is bound to C-s, will now be
bound to C-~.  The command to insert the next character typed, C-q, is now
C-\\.  The command C-x C-q is now C-x C-\\.")
    (pop-to-buffer buffer)))

8<------------------------------ Cut Here ------------------------------>8

-- 
 William C. DenBesten
 denbeste@bgsu.edu