42.13.1 Input Modes

Function: set-input-mode interrupt flow meta &optional quit-char

This function sets the mode for reading keyboard input. If interrupt is non-nil, then Emacs uses input interrupts. If it is nil, then it uses CBREAK mode. The default setting is system-dependent. Some systems always use CBREAK mode regardless of what is specified.

When Emacs communicates directly with X, it ignores this argument and uses interrupts if that is the way it knows how to communicate.

If flow is non-nil, then Emacs uses XON/XOFF (C-q, C-s) flow control for output to the terminal. This has no effect except in CBREAK mode.

The argument meta controls support for input character codes above 127. If meta is t, Emacs converts characters with the 8th bit set into Meta characters, before it decodes them as needed (see Terminal I/O Encoding). If meta is nil, Emacs disregards the 8th bit; this is necessary when the terminal uses it as a parity bit. If meta is the symbol encoded, Emacs first decodes the characters using all the 8 bits of each byte, and then converts the decoded single-byte characters into Meta characters if they have their eighth bit set. Finally, if meta is neither t nor nil nor encoded, Emacs uses all 8 bits of input unchanged, both before and after decoding them. This is good for terminals that use 8-bit character sets and don’t encode the Meta modifier as the eighth bit.

If quit-char is non-nil, it specifies the character to use for quitting. Normally this character is C-g. See Quitting.

The current-input-mode function returns the input mode settings Emacs is currently using.

Function: current-input-mode

This function returns the current mode for reading keyboard input. It returns a list, corresponding to the arguments of set-input-mode, of the form (interrupt flow meta quit) in which:

interrupt

is non-nil when Emacs is using interrupt-driven input. If nil, Emacs is using CBREAK mode.

flow

is non-nil if Emacs uses XON/XOFF (C-q, C-s) flow control for output to the terminal. This value is meaningful only when interrupt is nil.

meta

is t if Emacs treats the eighth bit of input characters as the Meta bit before decoding input; encoded if Emacs treats the eighth bit of the decoded single-byte characters as the Meta bit; nil if Emacs clears the eighth bit of every input character; any other value means Emacs uses all eight bits as the basic character code.

quit

is the character Emacs currently uses for quitting, usually C-g.