Re: Tramp over eshell local vs. remote directories

Michael Albinus <[email protected]>
Newsgroups gmane.emacs.tramp
Message-ID <[email protected]>
Reza Housseini <[email protected]> writes:

> Hi Michael

Hi Reza,

> I open a virgin emacs with emacs -Q and then connect to a remote
> server via dired: C-x d /ssh:[email protected]:/some/directory and
> from there open a eshell M-x eshell.
> Now when I change directory in the eshell with cd ~ I go back to my
> local user directory. I this intended behavior (kind of unexpected)
> and is there a way to stay on the remote side?

Yes, this is intended. "cd" is a built-in command of eshell, and it
interprets the directory name like a Lisp file name. "~" is your local
home directory. If you do "C-x C-f ~", you will always open your local
home directory, whereever you call it from in Emacs.

Since Emacs 29, there is the extension module eshell-elecslash. Add the
following lines to your .emacs:

--8<---------------cut here---------------start------------->8---
(require eshell
(add-to-list 'eshell-modules-list 'eshell-elecslash)
--8<---------------cut here---------------end--------------->8---

Now, when you are in eshell on a remote directory, and you type a
command argument beginning with "/" or "~/", this will be replaced by
the remote file identification. That is, in your example you type
"cd ~/" and that's it. Read the Eshell manual.

> Thanks for any hints!
>
> Cheers,

Best regards, Michael.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.