Hi!

Michael Albinus <[email protected]> writes:

> (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."
>   (setq directory (or directory "~/"))
>   (unless (file-remote-p directory)
>     (setq directory (concat (file-remote-p default-directory) directory)))
>   (eshell/cd directory))
>
> In general, I argue against using Tramp internal functions. Their API is
> not guranteed to be kept. For example, tramp-make-tramp-file-name has
> changed its argument list in Tramp 2.4.0 (Emacs 27.1), the old argument
> list (which you use) is kept for backward compatibility. When Tramp
> throws compatibility for Emacs 26, this backward compatibility might be
> skipped.

Good info. I updated my config and will keep it in mind.
Thanks :)

Cheers,
  Daniel

Reply via email to