C-s and C-q are used in the XON/XOFF flow control protocol. This screws up Emacs because it binds these characters to commands. Also, by default Emacs will not honor them as flow control characters and may overwhelm output buffers. Sometimes, intermediate software using XON/XOFF flow control will prevent Emacs from ever seeing C-s and C-q.
Possible solutions:
Your terminal may use XON/XOFF flow control to have time to display all the characters it receives. For example, VT series terminals do this. It may be possible to turn this off from a setup menu. For example, on a VT220 you may select `No XOFF' in the setup menu. This is also true for some terminal emulation programs on PCs.
When you turn off flow control at the terminal, you will also need to turn it off at the other end, which might be at the computer you are logged in to or at some terminal server in between.
If you turn off flow control, characters may be lost; using a printer connected to the terminal may fail. You may be able to get around this problem by modifying the `termcap' entry for your terminal to include extra NUL padding characters.
If you are using a dialup connection, the modems may be using XON/XOFF flow control. I don't know how to get around this.
Some network box between the terminal and your computer may be using XON/XOFF flow control. It may be possible to make it use some other kind of flow control. You will probably have to ask your local network experts for help with this.
If your connection to Emacs goes through multiple tty and/or pty devices, they may be using XON/XOFF flow control even when it is not necessary.
Eirik Fuller <eirik@theory.tn.cornell.edu> writes:
Some versions of `rlogin' (and possibly telnet) do not pass flow control characters to the remote system to which they connect. On such systems, Emacs on the remote system cannot disable flow control on the local system. Sometimes `rlogin -8' will avoid this problem.
One way to cure this is to disable flow control on the local host (the one running rlogin, not the one running rlogind) using the stty command, before starting the rlogin process. On many systems, `stty start u stop u' will do this.
Some versions of `tcsh' will prevent even this from working. One way around this is to start another shell before starting rlogin, and issue the stty command to disable flow control from that shell.
Use `stty -ixon' instead of `stty start u stop u' on some systems.
(set-input-mode nil t)If you are fixing this for yourself, simply put the form in your .emacs file. If you are fixing this for your entire site, the best place to put it is unclear. I don't know if this has any effect when used in lisp/site-init.el when building Emacs; I've never tried that. {Can someone tell me whether it works?} Putting things in users' .emacs files has a number of problems. Putting this form in lisp/default.el has the problem that if the user's .emacs file has an error, this will prevent lisp/default.el from being loaded and Emacs may be unusable for the user, even for correcting their .emacs file (unless they're smart enough to move it to another name). A possible solution is to initially disable C-s and C-q by setting keyboard-translate-table in lisp/site-init.el, either with swap-keys (see section How do I "swap" two keys?) or with the following form:
;; by Roger Crew <crew@cs.stanford.edu>: (setq keyboard-translate-table "\C-@\C-a\C-b\C-c\C-d\C-e\C-f\C-g\C-h\C-i\C-j\C-k\C-l\C-m\C-n\C-o\C-p\C-^\C-r\C-\\\C-t\C-u\C-v\C-w\C-x\C-y\C-z\C-[\C-s\C-]\C-q\C-_")This will at least prevent Emacs from being confused by the flow control characters, even if lisp/default.el cannot be loaded. Then, in lisp/default.el, enable XON/XOFF flow control with set-input-mode.
For further discussion of this issue, read the file PROBLEMS in the Emacs distribution.