[comp.emacs] GNU Emacs on VMS flow control

Dan_Jacobson@ATT.COM (10/09/90)

[he wanted help on flow control]

Here's one of our brilliant local help files, only tested on UNIX, not VMS.

From: Dan Jacobson
Subject: Control-S Control-Q (X-on/X-off flow control protocol) problems
Date: 10/1990

On many system/network/terminal combinations there is difficulty
passing the characters Control-S and Control-Q, as they are used by
the computer/terminal to tell one side to start/stop sending
characters to prevent buffer overflow.

Early on I decided to always use Control-] for Control-S, and
Control-\ for Control-Q (set in my ".emacs" file), (i.e.  I hit a
Control-] and GNU Emacs interprets it at a low level internally as a
Control-S, I don't hit Control-S on my keyboard anymore...  same with
the Control-\ Control-Q pair) here's how:

(setq term-setup-hook
      (function (lambda ()

	;always use C-] for C-s, and C-\ for C-q for uniformity, even though
	;some terminals and baud rates do not have a "flow control" problem
	(set-input-mode nil t)
	(let ((the-table (make-string 128 0)) (i 0))
	  (while (< i 128)
	    (aset the-table i i)
	    (setq i (1+ i)))
	  (aset the-table ?\C-\\ ?\C-q)
	  (aset the-table ?\C-\] ?\C-s)
	  (setq keyboard-translate-table the-table))
	(message "Using C-] for C-s, and C-\\ for C-q")
      )))

Though I liked control-] as a remap choice because it is usually in
the same spot on most keyboards, I am having second thoughts, as it is
often the "telnet" program's default enter-command-mode character
(telnet is one remote login method).  And as of this writing, telnet
doesn't read a ".telnetrc" file to allow changes at start-up time...
-- 
Dan_Jacobson@ATT.COM  Naperville IL USA  +1 708-979-6364

palkovic@linac.fnal.gov (palkovic@linac.fnal.gov (John A. Palkovic)) (10/09/90)

In article <1990Oct8.215804.11443@cbnewse.att.com> danj1@ihlpa.att.com writes:
>[he wanted help on flow control]
[he posted a solution]

From the FAQL posted once upon a time in gnu.emacs, this one rebinds
the keys to C-. and C-\, so it won't hose telnet. It also gives you
the capability to undo. Of course it can be hacked to rebind the
keys to something else...
--
(defun evade-flow-control ()
  "Replace ^S with ^\\ and ^Q with ^."
  (interactive)
  (let ((the-table (make-string 128 0)))
    (let ((i 0))
      (while (< i 128)
	(aset the-table i i)
	(setq i (1+ i))))
    ;; Swap ^S and ^\
    (aset the-table ?\034 ?\^s)
    (aset the-table ?\^s ?\034)
    ;; Swap ^Q and ^^
    (aset the-table ?\036 ?\^q)
    (aset the-table ?\^q ?\036)
    (setq flow-control-evasion t)
    (setq keyboard-translate-table the-table)))

(defun unevade-flow-control ()
  "Return ^S and ^Q to their normal mappings."
  (interactive)
  (cond ((null flow-control-evasion) nil)
	(t ;;; Swap back ^S
	 (aset keyboard-translate-table ?\034 ?\034)
	 (aset keyboard-translate-table ?\^s ?\^s)
	 ;; Swap ^Q and ^^
	 (aset keyboard-translate-table ?\036 ?\036)
	 (aset keyboard-translate-table ?\^q ?\^q)
	 (setq flow-control-evasion nil))))


-- 
John Palkovic {att,uunet}!tellab5!linac!palkovic	
palkovic@linac.fnal.gov, {att,uunet}!linac.fnal.gov!palkovic works too.
Home: linac!jpmac!johnny

puglia@cunixa.cc.columbia.edu (Paul Puglia) (10/10/90)

In article <1990Oct8.215804.11443@cbnewse.att.com> danj1@ihlpa.att.com writes:
>Though I liked control-] as a remap choice because it is usually in
>the same spot on most keyboards, I am having second thoughts, as it is
>often the "telnet" program's default enter-command-mode character
>(telnet is one remote login method).  And as of this writing, telnet
>doesn't read a ".telnetrc" file to allow changes at start-up time...
>-- 
>Dan_Jacobson@ATT.COM  Naperville IL USA  +1 708-979-6364

If you are running ksh, you can alias the telnet command with the 
the command line flags that will move the enter-command-mode to another key.
I use a similar trick on VMS with symbols to move the interupt remote process
character from ^C (on my telnet) to a less annoying character.   


Paul Puglia
Dept. of Civil Engineering
Columbia University
puglia@cucevx.civil.columbia.edu