I use the shell
command via C-u M-x shell
to open a shell on a remote server by giving as default directory the path to the remote server (e.g /[email protected]:/home/user
) (which should have the same effect as the method described in this answer).
The directory of the buffer is at the beginning in sync with the directory of the shell (/[email protected]:/home/user`), and tab completion works as expected giving me choices from the remote directory.
However, when you issue
cd ~
in the remote shell, the buffer directory is set to the local home path, so that I get tab completion for local directories which obviously does not make any sense in the remote shell.
How can I keep the directory tracking in sync even when I use cd in the remote shell? - I'm using GNU Emacs 23.1.1 on Centos, remote machine is Linux too.
C-u M-x shell
andC-x d /ssh:username@hostname:/path return M-x shell
aren't equivalent? Does shell completion still work if you use the longer workaround?C-x d /ssh:username@hostname:/path return M-x shell
. In fact, I found out how to force the out-of-sync problem: just docd ~
in the remote shell! (Will update the question accordingly.)cd ~
that will force shell to sync without doing a change directory?