Path: utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!mailrus!uflorida!gatech!bbn!jr@bbn.com From: jr@bbn.com (John Robinson) Newsgroups: gnu.emacs Subject: Re: Flow Control on DECServer 200s Message-ID: <33514@bbn.COM> Date: 14 Dec 88 14:59:55 GMT References: <8812140754.AA08784@prep.ai.mit.edu> <1312@cps3xx.UUCP> Sender: news@bbn.COM Reply-To: jr@bbn.com (John Robinson) Distribution: gnu Organization: BBN Systems and Technologies Corporation, Cambridge MA Lines: 125 In-reply-to: usenet@cps3xx.UUCP (Usenet file owner) In article <1312@cps3xx.UUCP>, usenet@cps3xx (Usenet file owner) writes: >in article <8812140754.AA08784@prep.ai.mit.edu>, ROBERTS%UORNSRL.BITNET@MITVMA.MIT.EDU says: >> >> I'm running GNU Emacs 18.52.2 under VAX/VMS 4.7 on one of several vaxen >> connected through a terminal server (DECServer 200). When emacs starts up >> or restarts after being suspended, the terminal server is put in pasthru >> mode, but flow control is not disabled. I can disable flow control >> (XON/XOFF) on the server manually, but this is undesirable due to the need >> to turn it back on later. >Why just include the lines: > >(global-unset-key "\C-s") >(global-unset-key "\C-q") > >in your .emacs file? Granted you lose isearch-forward that way, but you >can you something like: > >(global-set-key "\C-z" 'isearch-forward) I have appended the file I send out from time to time to address the cope-with-the-flow-control-losing-world's problems; it is a little more elaborate than the above suggestion. This list hasn't seen it yet, at any rate. I think the original poster asked for some VMS help; though I have neer worked with the term servers, I suspect VMS somehow has the ability to manipulate you terminal line's settings. That avoids having to have a "non-standard" keyboard setup and may be the best approach; your "emacs" command would be a macro that (1) turns off server flowcontrol, (2) executes emacs and (3) turns it back on before returning to DCL. Now maybe VMS/decserver aren't that smart. I think there may be a way to store the terminal-end incantations that turn flow control on and off under function keys in the HDS terminal, and then get the terminal to send these sequences back towards the terminal server by a host command (really! the HDS people made their terminal too clever for its own good). Then you just add the control sequences to the terminal's init and exit termcap strings, and voila. -------- GNU emacs (version 18.48 and later) provides several options for coping with terminals or front-ends that insist on using flow control characters. Listed in estimated order of preference. 1. Have Emacs run in CBREAK mode with the kernel handling flow control. Issue (set-input-mode nil t) from .emacs. It is now necessary to find other keys to bind to the commands isearch-forward and quoted-insert. Traditional nominees are C-^ and C-\. There are two ways to get this effect: 1a. Use the keyboard-translate-table to cause C-^ and C-\ to be received by Emacs as though C-S and C-Q were typed. Emacs (except at its very lowest level) never knows that the characters typed were anything but C-S and C-Q, so the use of these keys inside isearch still works - typing C-^ while incremental searching will move the cursor to the next match, etc. Here's some code for this: (setq keyboard-translate-table (make-string 128 0)) (let ((i 0)) (while (< i 128) (aset keyboard-translate-table i i) (setq i (1+ i)))) (aset keyboard-translate-table ?\^\\ ?\^s) (aset keyboard-translate-table ?\^^ ?\^q) 1b. Simply rebind the keys C-^ and C-\ to isearch-forward and quoted-insert. To get continued searches inside isearch it is also necessary to set search-repeat-char to C-^. 2. Don't use CBREAK mode, and cause C-S and C-Q to be bound to a null command. The problem with this is that whatever sent the flow control characters is apt to be falling behind the characters being sent to it, and so what finds its way to the terminal screen will not in general be what is intended. It will be still be necessary to find other keys to bind to isearch-forward and quoted-insert; see 1a and 1b above. Here is a suitable null command: (defun noop () "Do nothing; return nil." (interactive)) 3. Don't use CBREAK mode, and global-unset-key the keys C-S and C-Q. This is similar to #2, except that the flow control characters will probably cause beeps or visible bells. Note that, if the terminal is the source of flow control characters and kernel flow control handling is enabled, it will not in general be necessary to send padding characters as specified in a termcap or terminfo entry. It may be possible to customize a termcap entry to provide better Emacs performance on the assumption that flow control is in use. This effect can also be simulated by announcing (with stty(1) or its equivalent) that the terminal is running at a very slow speed, provided the terminal is not directly wired to the host. Some Background This section attempts to answer the question "Why does emacs choose to use flow-control characters in its command character set?" For another view, please read the comments on flow control in emacs/INSTALL from the distribution. Flow control was not necessary for most terminals once upon a time, so use of C-S and C-Q for command characters was reasonable. Emacs, for economy of keystrokes and portability, chose to use the control characters in the ASCII character set for its functions, and tried to use mnemonic assignments (S for search, Q for quote). There are other (albeit less common in practice) ways to do flow control that preserve transparency of the character stream. Once emacs' precedent was established, it was too hard to undo. One might even argue that emacs' use of these control characters predates their use by terminals and front-ends for flow control. Notice also that the latter use is ONLY a de-facto standard. In fact, on the model 33 teletype with a paper tape punch (which is VERY old), they were used for the host to turn the punch on and off! So which usage is "right", emacs' or the terminal/front-end manufacturer's? This is a rhetorical (or religious) question; it has no simple answer. -- /jr jr@bbn.com or bbn!jr