In my local shell, completion-at-point after cd returns a list of directories. However, when I ssh into a remote, Emacs thinks I'm still in my local home directory. How can I configure Emacs to give me remote directory autocompletion?

  • Just to clarify, you're doing M-x shell from a local directory and then doing ssh command in that buffer?
    – Melioratus
    Nov 8, 2015 at 20:39
  • That is correct. Nov 8, 2015 at 20:41
  • 1
    Have you tried using opening the remote directory using C-x d /ssh:username@hostname:/directory-path and then using M-x shell to open a remote shell?
    – Melioratus
    Nov 8, 2015 at 20:54
  • Interesting! Now autocompletion works, but typing is intolerably slow. Nov 8, 2015 at 20:57
  • 1
    I tried disabling global-projectile-mode and the situation improved significantly! Nov 10, 2015 at 15:12

1 Answer 1


Try this

  1. Open a remote directory in dired using tramp.

    C-x d /ssh:username@hostname:/path return

  2. Start a remote shell.

    M-x shell

  • Is there a way to make something like this work with Emacs term or preferably multi-term Feb 15, 2016 at 13:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.