Mac – Emacs eshell over SSH not obeying key commands or elisp

emacsssh

When SSHing to a remote server Eshell doesn't behave very well, e.g:

M-x eshell
ssh server
<tab> *inserts literal tab instead of trying to complete*

Hitting <tab>, for instance, inserts a literal tab. Is there no way to get tab completion, lisp interaction (like find-file blah) etc. over SSH? All the documentation I've read says Eshell is "TRAMP-aware", which I assume meant it could deal with this.

Am I just wrong in my assumption that it would work over SSH, or is something broken?

This is on Emacs 24.0.94 pretest.

Best Answer

SSH is actually integrated into Eshell using Tramp-mode, so instead of running the "ssh" command you use cd with a special pathname:

~ $ cd /ssh:user@host.com:~
/ssh:user@host.com:/home/user $ 

Then you should have tab-completion for commands and filenames on the remote server. Tab completion can be laggy though depending on how many alternatives it has to look up remotely and transfer over the network.

If your muscle memory betrays you and you keep typing "ssh", you might want to define an alias in eshell (this will automatically get saved to ~/.emacs.d/eshell/alias)

$ alias ssh 'cd /ssh:$1:~'

Also of note, when Eshell is on a remote server and you hit C-x C-f it will complete filenames on the remote server. They will be automatically loaded into a local buffer and written back over SCP. You can do that without Eshell, too, it's a feature of tramp-mode.

Related Question