[comp.emacs] Gnu Emacs ^Q & ^S problems

creps@silver.bacs.indiana.edu (11/04/87)

   I'm having a little trouble with using Gnu Emacs, in that the thing
thinks that flow control characters (^Q ^S) are commands. So, every time
there is a lot of stuff going to the screen, the flow control characters
get sent, and are interpreted as search commands. Then more stuff gets
sent asking what to search for, more ^Q's and ^S's, then the terminal
starts beeping, and so on, until I have to type about 100 ^Z's to stop
the thing.

   Not having a Gnu Emacs manual that I can find, I'm asking for help here.
The closest thing I've come up with to fix this is binding ^Q and ^S to
what-cursor-position. Then whenever flow control is inserted, it just
prints information on the status line. But even this doesn't completely
fix it, since sometimes when this happens the screen is messed up.

   What I'm looking for is some kind of a null command, that will do nothing,
not even print to the status line. Just unsetting ^Q and ^S won't work,
because undefined keys cause a ^G (bell) to be sent, and the old problem
of the "infinite" loop of ^G's starts again.

   I would appreciate any help on this.
-	-	-	-	-	-	-	-	-
Steve Creps on the VAX 8650 running Ultrix 2.0-1 at Indiana University.
	creps@silver.bacs.indiana.edu
"Well, I noticed the lad with the thermonuclear device was the Chief
 Constable for the area."

creps@silver.bacs.indiana.edu (11/04/87)

   Well, I've got the problem solved, thanks to Tony Brancato at
SUNY Buffalo. The solution was to write a null Mock Lisp function,
and bind ^Q & ^S to it. Actually, there was a little more to it
than that, but if anyone is interested in the actual code, they can
mail me.
-	-	-	-	-	-	-	-	-
Steve Creps on the VAX 8650 running Ultrix 2.0-1 at Indiana University.
	creps@silver.bacs.indiana.edu
"Well, I noticed the lad with the thermonuclear device was the Chief
 Constable for the area."

matt@oddjob.UChicago.EDU (D 1 4 U 2 C) (11/10/87)

In article <20600002@silver> creps@silver.bacs.indiana.edu writes:

)    I'm having a little trouble with using Gnu Emacs, in that the thing
) thinks that flow control characters (^Q ^S) are commands. 

This probably belongs in a "commonly asked questions" file.

GNU emacs can handle these terminals.  When using such a terminal you
should execute (set-input-mode nil t).  Type that expression, with
the parens, after hitting ESCAPE twice, or put it into your ~/.emacs
file if you want it to always be in effect.

Documentation of set-input-mode:
Set mode of reading keyboard input.
First arg non-nil means use input interrupts; nil means use CBREAK mode.
Second arg non-nil means use ^S/^Q flow control for output to terminal
 (no effect except in CBREAK mode).

With this in effect, emacs will never see ^S and ^Q.

You can go a step further and get back the functions of ^S and ^Q on
some other keys without having to track down all the places they are
referenced by doing:
     (setq keyboard-translate-table
	   "\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016
\017\020\021\022\023\024\025\026\027\030\031\032\033\023\035\021\037")

(I have split the last line in two so it doesn't get munched on the
way out.  Splice it back together before using.)  This maps the keys
you type so that when you type ^\ or ^^, all parts of emacs except
for the very lowest input processor think that you have actually
typed ^S or ^Q respectively.
________________________________________________________
Matt	     University		matt@oddjob.uchicago.edu
Crawford     of Chicago     {astrovax,ihnp4}!oddjob!matt

rbp@investor.UUCP (Bob Peirce) (11/17/87)

>    I'm having a little trouble with using Gnu Emacs, in that the thing
> thinks that flow control characters (^Q ^S) are commands. So, every time
> there is a lot of stuff going to the screen, the flow control characters
> get sent, and are interpreted as search commands. Then more stuff gets
> sent asking what to search for, more ^Q's and ^S's, then the terminal
> starts beeping, and so on, until I have to type about 100 ^Z's to stop
> the thing.

I had the same problem with uEmacs so I modified the input routines to
pass ^S and ^Q.  I imagine you could do the same thing in gnu.  Of course
this will not make emacs experts very happy since you will have to rebind
the routines called by these keys to something else.  I uses M-/ for ^S,
since it was similar to vi.
-- 
Bob Peirce, Pittsburgh, PA				 412-471-5320
uucp: ...!{allegra, bellcore, cadre, idis, psuvax1}!pitt!investor!rbp
	    NOTE:  Mail must be < 30K  bytes/message

lawitzke@eecae.UUCP (John Lawitzke) (11/19/87)

>>    I'm having a little trouble with using Gnu Emacs, in that the thing
>> thinks that flow control characters (^Q ^S) are commands.
> 
> I had the same problem with uEmacs so I modified the input routines to
> pass ^S and ^Q.  I imagine you could do the same thing in gnu.

Far easier in GNU Emacs is to create the file ".emacs" in your home
directory and include the lines:

(global-unset-key "\C-s")
(global-unset-key "\C-q")

Of course this totally disables <ctrl>Q and <ctrl>S so anything that
you have bound to them will have to be run the long way(ie M-X ......)

-- 
j                                UUCP: ...ihnp4!msudoc!eecae!lawitzke
"And it's just a box of rain..." ARPA: lawitzke@eecae.ee.msu.edu  (35.8.8.151)

jr@LF-SERVER-2.BBN.COM.UUCP (11/19/87)

> I had the same problem with uEmacs so I modified the input routines to
> pass ^S and ^Q.  I imagine you could do the same thing in gnu.  Of course
> this will not make emacs experts very happy since you will have to rebind
> the routines called by these keys to something else.  I uses M-/ for ^S,
> since it was similar to vi.

GNU emacs gives you some other options (this comes up so often we
should just repost it every now and then, like the usenet etiquette
messages.)

1.  You can run in CBREAK mode with the kernel handling flow control.
Issue (set-input-mode nil t) from your .emacs.  This leads to the
problem above that you have to bind other keys to isearch-forward and
quoted-insert.  Traditional nominees are C-^ and C-\.  There is a
further problem, however; the interactive key set inside isearch
includes ^S and there is no convenient way to change this (yet).

2.  You can use the keyboard-translate-table to cause, say, C-^ and
C-\ to be received by emacs as though you had typed ^S and ^Q.  This
avoids the problem above, since even the insides of iearch will be
fooled.

I think I'll save this file away for future use.

/jr
jr@bbn.com or jr@bbn.uucp

rbj@ICST-CMR.ARPA (Root Boy Jim) (11/26/87)

   From: John Robinson <jr@LF-SERVER-2.BBN.COM>

   1.  You can run in CBREAK mode with the kernel handling flow control.
   Issue (set-input-mode nil t) from your .emacs.  This leads to the
   problem above that you have to bind other keys to isearch-forward and
   quoted-insert.  Traditional nominees are C-^ and C-\.  There is a
   further problem, however; the interactive key set inside isearch
   includes ^S and there is no convenient way to change this (yet).

I am surprised that such a normally astute emacs hacker would overlook
the following feature: M-x describe-variable RET search-repeat-char RET

	search-repeat-char's value is 19

	Documentation:
	Character to repeat incremental search forwards.

In fact, all the special search characters are parameterizable.

I would also argue that the isearch-forward and isearch-backward might
ought to bind these variables to whatever function key that invoked
the search under certain conditions, say that it was a control char.

   /jr
   jr@bbn.com or jr@bbn.uucp

	(Root Boy) Jim Cottrell	<rbj@icst-cmr.arpa>
	National Bureau of Standards
	Flamer's Hotline: (301) 975-5688
Boys, you have ALL been selected to LEAVE th' PLANET in 15 minutes!!

jfjr@MITRE-BEDFORD.ARPA (11/28/87)

  In regards to rebinding i-search to ^\ and problems with the isearch
repeat:
  I had to do (set-input-mode nil t) and at my installation
there are an infinite number of vt100's so in the site init.el
the keyboard map is set so ^\ maps to ^S. ^^ to ^Q, the mapping
for ^S and ^Q is unchanged(^S to ^S etc. I have no trouble getting a repeat
isearch by hitting ^\. I experimented with almost all the remedies
to the ^s ^q problem and the one I use seems to best. I even
tried turning off flow control from my terminal but I had to to
a lot of ^L to repaint the screen and when I was out of emacs I
got trashed screens.

                                    Jerry Freedman,Jr
                                    jfjr@mitre-bedford.arpa