Subject: Re: bug#31355: 26.1; [PATCH] Fix remote-host/tramp directory tracking for shells in `term' buffers

From: Michael Albinus <[email-masked]>
Date: Thu, 03 May 2018 16:59:02 +0200

Phil Sainty <[email-masked]> writes:

Hi Phil,

>> I believe it is always save to use term-ansi-at-user. There's no need
>> to check, whether it is equal to (user-real-login-name).
>
> I've not changed this.  The code is evidentially deciding whether the
> user/host pair being tracked in the shell in the term buffer is a match
> for the user/host pair known locally to Emacs.  Unless both of those
> components match, a tramp path is created.  I've not tested the case
> of a different user on the local host, but it seems like reasonable
> logic to me, at first look.

Of course.

> (if (and (string= term-ansi-at-host (system-name))
>          (string= term-ansi-at-user (user-real-login-name)))
>     ;; Use a local path

OK.

>   ;; Use a tramp path

And here I believe you could always apply

(format "/-:%s@%s:%s" term-ansi-at-user term-ansi-at-host term-ansi-at-dir)

Best regards, Michael.