[comp.emacs] C-S again

agw@convent.columbia.edu (Art Werschulz) (06/15/88)

Hi all.

I never thought I'd need this information, so I didn't pay all that
much attention to it when it appeared the first time.

At the other place where I work, we're installing VMS GNU Emacs in a
setting in which good ol' C-S/C-Q are used for flow control.  (Please,
no flames!  It's not my fault, and it wasn't my decision.)  Could
somebody send me the keyboard-translation-table that should be set up
so that C-\ could do whatever C-S is supposed to?

Thanks.

	Art Werschulz

 	ARPAnet:  agw@columbia.edu
	USEnet:   ... seismo!columbia!agw
	BITnet:   agw@columbia.edu
	CCNET:    agw@garfield
	ATTnet:   Columbia University (212) 280-3610 280-2736
		  Fordham University  (212) 841-5323 841-5396

fad@think.COM (franklin a davis) (06/17/88)

In article <5700@columbia.edu> agw@columbia.edu (Art Werschulz) writes:
>Could somebody send me the keyboard-translation-table that should be set up
>so that C-\ could do whatever C-S is supposed to?

This file should be part of the distribution, because there will always
be people who need it!

; xonxoff.el -- use control flow in gnuemacs
;kuling:/usr/alla/christer/emacs/xonxoff.el, thu apr 10 20:50:38 1986,
; edit by: christer johansson (christer@kuling)
; changed docstring of xon-xoff-mode. removed -*- line. 
;edited: tue nov 19 1985 by christer@kuling (christer johansson)
; /usr/alla/christer/emacs/xonxoff.el added variables c-{s,q}-replacement.
;edited: mon nov 11 1985 by christer@kuling (christer johansson)
; /usr/alla/christer/emacs/xonxoff.el works under ver. 16.60
;installed 4/28/86 by mark ardis at wang institute

;; make the identity translation table.
(progn (setq keyboard-translate-table (make-string 128 0))
       (let ((i 0))
	 (while (< i 128)
	   (aset keyboard-translate-table i i)
	   (setq i (1+ i)))))

(defvar xon-xoff-mode t
  "controls the xon-xoff mode.
if this variable is nil, xon-xoff-mode is off.")
       
(defun xon-xoff-mode (arg)
  "xon-xoff mode's good if you want too use ^s and ^q for flow-control.
turns xon-xoff mode on if arg > 0, off if arg < 0.
with arg = 0, xon-xoff-mode toggles. 
if xon-xoff-mode is on, all ^^ typed by the user will be translated to ^q
before they are interpreted in any way. likewise ^\ will be translated to ^s.
If the options C-Q-Replacement and C-S-Replacement are set, there values will
be used instead of ^^ and ^\. ^q and ^s will be used for flow-controll in
xon-xoff-mode.
"
  (interactive "p")

  (setq xon-xoff-mode
	(if (and (zerop arg)
		 (boundp xon-xoff-mode))
	  (not xon-xoff-mode)
	  (> arg 0)))

  (set-input-mode nil xon-xoff-mode)

  (if xon-xoff-mode
      (progn (aset keyboard-translate-table
		   (if (boundp 'C-S-Replacement)
		       C-S-Replacement
		     ?\^\\)
		   ?\^s)
	     (aset keyboard-translate-table 
		   (if (boundp 'C-Q-Replacement)
		       C-Q-Replacement
		     ?\^^)
		   ?\^q))

    (aset keyboard-translate-table ?\^s ?\^s)
    (aset keyboard-translate-table ?\^q ?\^q)))

(xon-xoff-mode 1)



  franklin a davis  Thinking Machines Corp. Cambridge, MA 02142   617-876-1111
  <fad@think.com>   {ihnp4, harvard, seismo}!think!fad  "Roll away...the dew!"