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
/firstname.lastname@example.org:/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@example.com:/home/user`), and tab completion works as expected giving me choices from the remote directory.
However, when you issue
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.