I want to bypass comint-mode's completion support completely, instead relying on the subordinate process to do it for me. Specifically, if I'm running:
- emacs
- shell-mode
- bash
- shell-mode
Then I want TAB
to be passed to the bash process and expanded by it.
If I'm running:
- emacs
- shell-mode
- bash
- psql
- bash
- shell-mode
Then I'd want TAB
to be handled by psql.
I've tried this in a shell-mode-hook to no avail:
(define-key shell-mode-map "\t" 'self-insert-command)
When this is set, the TAB
key inserts a literal tab on the command line, which is not at all useful to me.
I've also tried this, but when I hit TAB
nothing happens:
(defun cr/comint-send-tab ()
"Send a tab character to the current buffer's process"
(interactive)
(comint-send-input t t)
(process-send-string (current-buffer) "\t"))
(define-key shell-mode-map "\t" 'cr/comint-send-tab)
How can I do this?