On Fri, Feb 14, 2025 at 12:04 PM Michael Albinus <michael.albinus@gmx.de> wrote:
Ship Mints <shipmints@gmail.com> writes:

Hi,

>     I'll check, whether I can improve this in Tramp.
>
> Perhaps something as simple as a buffer-local in either the main
> buffer or in the remote buffer, accessible via
> with-connection-local-variables?

My idea is rather to extend expand-file-name. If
tramp-show-ad-hoc-proxies is non-nil, it should return the whole ad-hoc
multi-hop remote file name. Something like this.

(I thought it is simple, but it looks a little bit more complex.)

The original multi-hop file name is gone by then if tramp-show-ad-hoc-proxies is nil globally. Let-binding tramp-show-ad-hoc-proxies to t in a function context still has to have a way to get the original remote file spec.