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? – Melioratus Nov 13 '16 at 17:42C-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.) – halloleo Nov 17 '16 at 05:36cd ~
that will force shell to sync without doing a change directory? – Melioratus Nov 17 '16 at 15:49pwd
command in shell to triggertramp
to refresh the remote execution path in the buffer. I've been looking for the original source but haven't found it. Does usingpwd
help at all? – Melioratus Nov 20 '16 at 02:30pwd
does not show the remote host - I think the emacs commandshell-resync-dirs
has to be enhanced somehow to find out whether the shell is on a remote host... – halloleo Nov 21 '16 at 05:44