How can I send a literal tab to bash in emacs' shell-mode?

Emacs shell-mode buffers are not terminals (i.e., they do not use ptys (pseudo-terminals)), so no program running in such a buffer (the shell, the programs run by the shell, etc.) can perform character-at-a-time input. Each line is typed in full and only sent when ENTER is pressed. To see proof, run the tty command in a shell-mode buffer, and it's output will be not a tty.


Try quoted-insert which is (by default) bound to C-q. The next character you type will be literally inserted into the buffer.

So C-qTAB will insert a literal tab.

I don't know what this does in comint modes (in regard to bash completion) and am not in a position to test it.


How about trying Emacs' terminal (instead of shell).

M-x term

Tags:

Emacs