50.3.9 Named ASCII Control Characters

TAB, RET, BS, LFD, ESC, and DEL started out as names for certain ASCII control characters, used so often that they have special keys of their own. For instance, TAB was another name for C-i. Later, users found it convenient to distinguish in Emacs between these keys and the corresponding control characters typed with the Ctrl key. Therefore, on most modern terminals, they are no longer the same: TAB is different from C-i.

Emacs can distinguish these two kinds of input if the keyboard does. It treats the special keys as function keys named tab, return, backspace, linefeed, escape, and delete. These function keys translate automatically into the corresponding ASCII characters if they have no bindings of their own. As a result, neither users nor Lisp programs need to pay attention to the distinction unless they care to.

If you do not want to distinguish between (for example) TAB and C-i, make just one binding, for the ASCII character TAB (octal code 011). If you do want to distinguish, make one binding for this ASCII character, and another for the function key tab.

With an ordinary ASCII terminal, there is no way to distinguish between TAB and C-i (and likewise for other such pairs), because the terminal sends the same character in both cases.