ARCHIVED: In Emacs, how do I handle C-s and C-q being used for flow control?
C-s
and C-q
are used in the XON/XOFF
flow control protocol. This can be a problem when you're
using Emacs, because Emacs binds these keys to commands by
default. Because Emacs won't honor them as flow control characters,
too many of these characters are not passed on and overwhelm output
buffers. Sometimes, intermediate software using XON/XOFF flow control
will prevent Emacs from ever seeing C-s
and
C-q
.
The following are some possible solutions:
- Disable the use of C-s and C-q for flow control:
You need to determine the source of the flow control:
- Your terminal: 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. You may be able to turn this
off from a setup menu. For example, on a VT220, in the setup menu, you
may select
When you turn off flow control at the terminal, you will also need to turn it off at the other end, which might be the computer you are logged into or 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.
. This is also true for some terminal
emulation programs on PCs.
- A modem: If you are using a dial-up connection, the modems may be using XON/XOFF flow control. It's not clear how to get around this.
- A router or terminal server: Some network server 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.
- tty and/or pty devices: 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. Sometimesrlogin -8
will avoid this problem. One way to cure this is to disable flow control on the local host (the one runningrlogin
, not the one runningrlogind
) using thestty
command, before starting therlogin
process. On many systems,stty start u stop u
will do this. Some versions oftcsh
will prevent even this from working. One way around this is to start another shell before startingrlogin
, and issue thestty
command to disable flow control from that shell. Usestty -ixon
instead ofstty start u stop u
on some systems.
- Your terminal: 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. You may be able to turn this
off from a setup menu. For example, on a VT220, in the setup menu, you
may select
- Make Emacs speak the XON/XOFF flow control
protocol: You can make Emacs treat
C-s
andC-q
as flow control characters by evaluating the following form to unconditionally enable flow control:(enable-flow-control)
To enable flow control selectively, evaluate the following form:(enable-flow-control-on "vt100" "h19")
Replacevt100
andh19
with the appropriate terminal names. These commands will automatically swapC-s
andC-q
toC-\
(the backslash) andC-^
(the caret). You can use variables to change the default swap keys (flow-control-c-s-replacement
andflow-control-c-q-replacement
).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 in thelisp/site-start.el
file. Putting this form inlisp/default.el
has the disadvantage that if a user's.emacs
file has an error, this will preventlisp/default.el
from being loaded and Emacs may be unusable for the user, even for correcting the.emacs
file (unless the file is moved to another name).For further discussion of this issue, read the file
PROBLEMS
(in the top-level directory when you unpack the Emacs source).
This information comes from the Emacs FAQ.
At Indiana University, for personal or departmental Linux or Unix systems support, see Get help for Linux or Unix at IU.
Related documents
This is document ajzb in the Knowledge Base.
Last modified on 2018-01-18 13:03:42.