[comp.emacs] Problem with GNU Emacs.

sramacha@uceng.UC.EDU (Sridhar Ramachandran) (12/08/89)

I have been having a problem with my GNU Emacs. Whenever I use
a sequence with C-S in it like search-forward and saving-buffers,
I scroll lock the terminal. It is as if Emacs hasn't read the
C-S at all. Then I have to type C-q to unlock the screen.
I am using a terminal with vt100 settings and default
Emacs settings. 

Can somebody help me out of this problem?

--Sridhar Ramachandran.

LC.YRS@forsythe.stanford.edu (Richard Stanton) (12/08/89)

In article <3071@uceng.UC.EDU>,
sramacha@uceng.UC.EDU (Sridhar Ramachandran) writes:
>
>I have been having a problem with my GNU Emacs. Whenever I use
>a sequence with C-S in it like search-forward and saving-buffers,
>I scroll lock the terminal. It is as if Emacs hasn't read the
>C-S at all. Then I have to type C-q to unlock the screen.
>I am using a terminal with vt100 settings and default
>Emacs settings.
>
Your problem is that somewhere in the connection between your
terminal/PC whatever and the host computer, the C-S is being
interpreted as a flow control character before it gets sent to
EMACS. Typing C-Q is the counterpart XON command, which unfreezes
things.

I don't know exactly your setup but on the systems I have had this
problem on, I have to escape back to telnet etc (usually using a
command like C-^, or C-^x) then switch off flowcontrol using a
command like "set flowcontrolto=none" (TELNET) or
"term flow none" (Stanford tip). This will solve your problem.

Richard Stanton

pstanton@gsb-what.stanford.edu

rdr@mdavcr.UUCP (Randolph Roesler) (12/08/89)

In article Richard Stanton writes:
>Your problem is that somewhere in the connection between your
>terminal/PC whatever and the host computer, the C-S is being
>interpreted as a flow control character before it gets sent to
>EMACS. Typing C-Q is the counterpart XON command, which unfreezes
>things.
 
>I don't know exactly your setup but on the systems I have had this
>problem on, I have to escape back to telnet etc (usually using a
>command like C-^, or C-^x) then switch off flowcontrol using a
>command like "set flowcontrolto=none" (TELNET) or
>"term flow none" (Stanford tip). This will solve your problem.

This is a big problem with GnuEmacs, on my system, turning flow control
off screws up the terminal servers.  It nice that the FSF provides
GnuEmacs to use masses, but I wish that Stallman was not so religous
about things like C-s should be "search", not "Stop" (xoff).

You might have to redefine all C-s key patterns. 

Has anybody done this. (is use M-s for search, and skip the other 
C-s bindings).


-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It's not the size of your signature that 	Randy Roesler
counts - it's how you use it!			MacDonald Dettwiler & Assc.
email ...!uunet!van-bc!mdavcr!rdr		BC Canada 604-278-3411

tbrakitz@phoenix.Princeton.EDU (Triantaphyllos Byron Rakitzis) (12/08/89)

Okay, regarding C-s, one of the neat things I did was to bind C-x RET
to save-buffer. Not only does it get rid of the stupid C-s binding
(which I use most of the time, but Princeton has a 7-bit network for
dumb terminals which does its own C-s C-q trapping---impossible to get
rid of) but hitting C-x RET is a very natural way to save a buffer.

As for isearch-forward, M-s is just fine. (though I simply don't
bother). 

-- 
"C Code."
	  "C Code run."
			"Run, Code, run!"
Byron Rakitzis. (tbrakitz@phoenix.princeton.edu ---- tbrakitz@pucc.bitnet)

6600tom@ucsbuxa.ucsb.edu (Tom Weinstein) (12/08/89)

In article <698@acrux.mdavcr.UUCP> rdr@mdavcr.UUCP (Randolph Roesler) writes:
> In article Richard Stanton writes:
>> Your problem is that somewhere in the connection between your
>> terminal/PC whatever and the host computer, the C-S is being
>> interpreted as a flow control character before it gets sent to
>> EMACS. Typing C-Q is the counterpart XON command, which unfreezes
>> things.
>
> This is a big problem with GnuEmacs, on my system, turning flow control
> off screws up the terminal servers.  It nice that the FSF provides
> GnuEmacs to use masses, but I wish that Stallman was not so religous
> about things like C-s should be "search", not "Stop" (xoff).
>
> You might have to redefine all C-s key patterns. 
>
> Has anybody done this. (is use M-s for search, and skip the other 
> C-s bindings).

The "standard" way to do this is to use the keyboard-translate-table.
This is an array of characters that emacs uses to translate the
characters it receives into other character before it interprets them.
This is what I have in my .emacs file:

    (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))))
      (aset keyboard-translate-table ?\^^ ?\^q)
      (aset keyboard-translate-table ?\^\\ ?\^s)
      (aset keyboard-translate-table ?\^? ?\^h)
      (aset keyboard-translate-table ?\^h ?\^?)))

This maps C-\ to C-s, and C-^ to C-q.  So, whenever you want to type
C-s, you use C-\ instead.  It also switches C-h and DEL, which is useful
if you are using a terminal that uses C-h for backspace instead of DEL.
If you have problems with your terminal sending C-s and C-q for flow
control, and emacs interpreting these as isearch-forward and
quoted-insert, use the command (set-input-mode nil t) in your .emacs
file.  This will tell emacs to use CBREAK mode, and use C-s/C-q for flow
control.

> -- 
> It's not the size of your signature that 	Randy Roesler
--
You have to look with better | Tom Weinstein      ...ucbvax!hub!ucsbuxa!6600tom
eyes than that! -- The Abyss | 6600tom@ucsbuxa.bitnet  6600tom@ucsbuxa.ucsb.edu

kjell@saturn.ucsc.edu (Kjell Post) (12/10/89)

If you use rlogin to get to another computer, try rlogin -8 instead.
-- 
      For athletes and programmers,  ! Kjell E. Post
a woman is the end of their career.  ! CIS/CE
                                     ! University of California, Santa Cruz
              -- A.Wickberg          ! Email: kjell@saturn.ucsc.edu

fst@gtenmc.UUCP (Fariborz "Skip" Tavakkolian) (12/10/89)

In article <698@acrux.mdavcr.UUCP> rdr@acrux.UUCP (Randolph Roesler) writes:
>In article Richard Stanton writes:
>>Your problem is that somewhere in the connection between your
>>terminal/PC whatever and the host computer, the C-S is being
>>interpreted as a flow control character before it gets sent to
>>EMACS. Typing C-Q is the counterpart XON command, which unfreezes
>>things.
> 
>>I don't know exactly your setup but on the systems I have had this
>>problem on, I have to escape back to telnet etc (usually using a
>>command like C-^, or C-^x) then switch off flowcontrol using a
>>command like "set flowcontrolto=none" (TELNET) or
>>"term flow none" (Stanford tip). This will solve your problem.
>
>This is a big problem with GnuEmacs, on my system, turning flow control
>off screws up the terminal servers.  It nice that the FSF provides
>GnuEmacs to use masses, but I wish that Stallman was not so religous
>about things like C-s should be "search", not "Stop" (xoff).
>
>You might have to redefine all C-s key patterns. 
>
>Has anybody done this. (is use M-s for search, and skip the other 
>C-s bindings).
>
>
>-- 
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>It's not the size of your signature that 	Randy Roesler
>counts - it's how you use it!			MacDonald Dettwiler & Assc.
>email ...!uunet!van-bc!mdavcr!rdr		BC Canada 604-278-3411


Here is something that was described in one of the read-me files with the
GNU Emacs that redefines ^S as ^\ and ^Q as ^^, so that any place you
are to type ^S you'll type ^\ etc.

;; First make a translate table that does the identity translation.
(set-input-mode nil t)
(setq keyboard-translate-table (make-string 256 0))
(let ((i 0))
 (while (< i 256)
  (aset keyboard-translate-table i i)
  (setq i (1+ i))))
 
;; Translate ^S to ^\ and ^Q to ^^
(aset keyboard-translate-table ?\^S ?\^\\)
(aset keyboard-translate-table ?\^\\ ?\^S)
(aset keyboard-translate-table ?\^Q ?\^^)
(aset keyboard-translate-table ?\^^ ?\^Q)

On the subject of ^S/^Q for flow control, I must say that in this day-and-age
there is no reason for terminals and computers not to use electronic flow
control (CTS/RTS) for async communication.

Hope this helps (not including my opinion)

Skip

-- 
----------------------------------------------------------------------------
Fariborz "Skip" Tavakkolian  -of-  Automated Cellular Engineering
Currently consulting         -at-  GTE Telecom, Inc. Bothell, Wa
Mail:                              tiny1!fst@mcgp1  -or-  fst@gtenmc

jr@bbn.com (John Robinson) (12/11/89)

In article <304@gtenmc.UUCP>, fst@gtenmc (Fariborz "Skip" Tavakkolian) writes:
>On the subject of ^S/^Q for flow control, I must say that in this day-and-age
>there is no reason for terminals and computers not to use electronic flow
>control (CTS/RTS) for async communication.

Hell, they ought to be able to run reliable link protocols, like HDLC
or LAPB.  And terminal front ends ought to be able to run transport
protocols like TCP.  And hosts ought to be able to run ...

But vendors of cruddy equipment that does none of these things will
continues to under-price or out-sell their competitors for a long
time.  And of course there is the deadly bugaboo, VT100 compatibility.
We could all try to vote with our desktops, but expecting the world to
change ovenight or even over-decade seems like dreaming.

Time to write a letter to Santa...
--
/jr, nee John Robinson     Life did not take over the globe by combat,
jr@bbn.com or bbn!jr          but by networking -- Lynn Margulis

ross@sybil.cs.Buffalo.EDU (Donald Ross) (12/12/89)

In article <3071@uceng.UC.EDU> sramacha@uceng.UC.EDU (Sridhar Ramachandran) 
writes:
>
>I have been having a problem with my GNU Emacs. Whenever I use
>a sequence with C-S in it like search-forward and saving-buffers,
>I scroll lock the terminal. It is as if Emacs hasn't read the
>C-S at all. Then I have to type C-q to unlock the screen.
>I am using a terminal with vt100 settings and default
>Emacs settings. 
>
>Can somebody help me out of this problem?
>
>--Sridhar Ramachandran.


Try     M-x (enable-flow-control)

This sets C-] equal to C-s so that you won't be locking the screen
scroll (which I know can be very annoying). Now, C-] will invoke
I-search and likewise C-x C-s will invoke save-buffer, etc.

If this is what your looking for just insert (enable-flow-control) in
your .emacs file.

				Don.
======================================================================
= =__________________DID_THIS_ACTUALLY_WORK?!______________________= =
= =Don Ross | Univ. of N.Y. at Buffalo | ross@sybil.cs.buffalo.edu = =
======================================================================

ross@sybil.cs.Buffalo.EDU (Donald Ross) (12/12/89)

I must apologize, in response to article <3071@uceng.UC.EDU>
sramacha@uceng.UC.EDU (Sridhar Ramachandran) writes: 
> 
>I have been having a problem with my GNU Emacs. Whenever I use
>a sequence with C-S in it like search-forward and saving-buffers,
>I scroll lock the terminal. It is as if Emacs hasn't read the
>C-S at all. Then I have to type C-q to unlock the screen.
>I am using a terminal with vt100 settings and default
>Emacs settings. 
>
>Can somebody help me out of this problem?
>
>--Sridhar Ramachandran.

I suggested (enable-flow-control) which I have since learned is local
only to SUNY at Buffalo. Sorry 'bout that, I'll do better next 
time 8^). 

				Don.
======================================================================
= =__________________DID_THIS_ACTUALLY_WORK?!______________________= =
= =Don Ross | Univ. of N.Y. at Buffalo | ross@sybil.cs.buffalo.edu = =
======================================================================

psm@cbnewse.ATT.COM (Steve Murphy) (12/13/89)

In article <14613@eerie.acsu.Buffalo.EDU> ross@sybil.cs.Buffalo.EDU.UUCP (Donald Ross) writes:
>In article <3071@uceng.UC.EDU> sramacha@uceng.UC.EDU (Sridhar Ramachandran) writes: 
>> 
>>I have been having a problem with my GNU Emacs...
>>
>>Can somebody help me out of this problem?
>>
>
>I suggested (enable-flow-control) ...

Put this line in your .emacs

(set-input-mode nil t)

This will turn on cbreak mode (the nil) and enable flow control (the t).
If you want more info get help on 'set-input-mode'. The only draw back is
this will disable keystrokes that use ^S/^Q. If you would like I can
send you a copy of my .emacs, I thinks I've remapped most of the
important bindings.
-- 
===============================================================================
Steve Murphy           |"My work is visionary or imaginative. That which can
1(312)510-4678         | be made explicit to the idiot is not worth my care..."
att!nwgpa!toolserv!psm |             - William Blake, Apocalypse by Imagination

drich@.UUCP (Dan Rich) (12/14/89)

In article <3071@uceng.UC.EDU> sramacha@uceng.UC.EDU (Sridhar Ramachandran) 
writes:
>
>I have been having a problem with my GNU Emacs. Whenever I use
>a sequence with C-S in it like search-forward and saving-buffers,
>I scroll lock the terminal. It is as if Emacs hasn't read the
>C-S at all. Then I have to type C-q to unlock the screen.
>I am using a terminal with vt100 settings and default
>Emacs settings. 
>
>Can somebody help me out of this problem?
>
>--Sridhar Ramachandran.

  Ah, one of these problems that rears its ugly head every few months
or so.  Yes, it would be nice if all of us had hardware flow control,
but, for now, it just isn't possible.  I have been using the elisp
code below (not written by me) for a couple of years now, and it seems
to solve the problem.  Now, if we could only convince RMS to include
it in with the GNU Emacs distribution... :-(

8<------------------------------ Cut Here ------------------------------>8
;;;	$Source: /u1/third_party/gnuemacs.v17/lisp/term/RCS/xon.el,v $
;;;	$Author: rlk $
;;;	$Locker:  $
;;;	$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
--
Dan Rich                    | ARPA: drich%dialogic@uunet.uu.net 
UNIX Systems Administrator  | UUCP: uunet!dialogic!drich
Dialogic Corporation        | - Time is an illusion.  Lunchtime, doubly so. -
(201) 334-8450 x213         |                           Douglas Adams

jr@bbn.com (John Robinson) (12/14/89)

Just a dumb niggle (so why the long note?):

In article <1013@dialogic.UUCP>, drich@.UUCP (Dan Rich) writes:
>We have chosen the characters C-~ (or C-^ on some terminals)
                               C-^     C-~

The VT100 has it wrong, folks, and this ain't the first time.  The way
to print a control character is to print a C- (or a ^) and then print
the printing character whose ascii value is 64 greater.  These are the
32 characters generated by:

 (progn (setq i 0)
        (while (< i 32)
          (insert (char-to-string (+ i 64)))
          (setq i (1+ i))))

that is (try it!):

  @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_

~ has the value 126.  C-~ would be the character whose code is 126-64,
or 62.  This character is > .

Some people express rubout as ^?.  This obeys the above prescription
if you make the operator a bitwise XOR instead of plus; ? has the code
63 and RUB 127.

Another rule would be "take the remainder mod 32 of the character
code".  C-~ works by this rule, but there is no guidance to make this
the representation preferred to C-> or C-^, since it is a many-one
rule.  Also, the rule needs an exception for C-? (as RUB), which needs
to be distinguished from C-_.

Apologies to those of you who can't see tilde or caret or underscore
or square- or angle-bracket characters; this note must be very
confusing.
--
/jr, nee John Robinson     Life did not take over the globe by combat,
jr@bbn.com or bbn!jr          but by networking -- Lynn Margulis

szoltek@gmu90x.gmu.edu (S.M. Zoltek) (12/14/89)

In article <14613@eerie.acsu.Buffalo.EDU> ross@sybil.cs.Buffalo.EDU.UUCP (Donald Ross) writes:
>I must apologize, in response to article <3071@uceng.UC.EDU>
>sramacha@uceng.UC.EDU (Sridhar Ramachandran) writes: 
>> 
>>I have been having a problem with my GNU Emacs. Whenever I use
>>a sequence with C-S in it like search-forward and saving-buffers,
>>I scroll lock the terminal. It is as if Emacs hasn't read the
>>C-S at all. Then I have to type C-q to unlock the screen.
>>I am using a terminal with vt100 settings and default
>>Emacs settings. 
>>
>>Can somebody help me out of this problem?
>>
>>--Sridhar Ramachandran.
>
>I suggested (enable-flow-control) which I have since learned is local
>only to SUNY at Buffalo. Sorry 'bout that, I'll do better next 
>time 8^). 
>
>				Don.
>======================================================================
>= =__________________DID_THIS_ACTUALLY_WORK?!______________________= =
>= =Don Ross | Univ. of N.Y. at Buffalo | ross@sybil.cs.buffalo.edu = =
>======================================================================

     I had a similar problem here at GMU and solved it by adding the
following lines to my .emacs file.  ^s is replaced by ^\ and centering
a line is ESC s.  In addition, custom tab stops have been defined and
text mode is the made the startup mode.

  

     	       CUT HERE AND INCLUDE IN YOUR .EMACS FILE
------------------------------------------------------------------------
;; Remap ^s and ^q keys because of flow control problems.
;; This will let one type ^\ to get ^s and
;; ^^ to get ^q.  On the vt220 typing contro-` sends the code for ^^
  ;; First make a translate table that does the identity translation
  (setq keyboard-translate-table (make-string 128 0))
  (let ((i 0))
    (while (< i 128)
      (aset keyboard-translate-table i i)
      (setq i (1+ i))))

;; Now alter translations of some characters.
  (aset keyboard-translate-table ?\^\\ ?\^s)
  (aset keyboard-translate-table ?\^^ ?\^q)
  (set-input-mode nil 't)
(setq default-major-mode 'text-mode)
(setq text-mode-hook 'turn-on-auto-fill)
(define-key global-map "\es" 'center-line)
(setq tab-stop-list (quote (5 10 15 20 25 30 35 40 45 50 55 60 65 70
75 80 85 90 95 100 105 110 115 120)))