tramp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tramp + eshell


From: Daniel Kraus
Subject: Re: Tramp + eshell
Date: Fri, 29 Oct 2021 09:29:34 +0200

Hi!

"H. Dieter Wilhelm" <dieter@duenenhof-wilhelm.de> writes:

> Hello
>
> I'm on GNU Emacs 28.0.60 (build 1, x86_64-w64-mingw32) of 2021-10-24
> when I open a remote file e.g.
>
> /plinx:Eval:
>
> and do an "M-x eshell" in this dired buffer, I'm getting an eshell in
> the same remote location (~ under a Gnu-Linux system).
>
> /plinkx:Eval:/home/vt1/uidg1626 $
>
> So far so good, but when I want to go to the remote root directory with
> "cd /" than eshell returns to a directory on my local machine!?
>
> When I try an existing remote directory under the root directory with
> "cd /srv" then eshell says "No such directory: /srv" even though this
> exists on the remote side.
>
> Am I expecting too much or am I missing here something?  Do you need
> further information on this behaviour?

It's like you said, when you "cd /" you're no longer on the remote server
but on your local machine.

I have this in my config to not "jump out":

  (defun eshell/lcd (&optional directory)
    "Like regular 'cd' but don't jump out of a tramp directory.
When on a remote directory with tramp don't jump 'out' of the server.
So if we're connected with sudo to 'remotehost'
'$ lcd /etc' would go to '/sudo:remotehost:/etc' instead of just
'/etc' on localhost."
    (if (file-remote-p default-directory)
        (with-parsed-tramp-file-name default-directory nil
          (eshell/cd
           (tramp-make-tramp-file-name
            method user nil host nil (or directory "") hop)))
      (eshell/cd directory)))


Then you can "lcd /" and you would end up in "/plinkx:Eval:/".

Cheers,
  Daniel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]