tramp-devel
[Top][All Lists]
Advanced

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

Re: No longer accessible host paths


From: Michael Albinus
Subject: Re: No longer accessible host paths
Date: Tue, 05 Nov 2019 09:09:08 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

JD Smith <address@hidden> writes:

Hi,

>     But badhost is just a guess, based on a possible current-buffer
>     with a remote default-directory. If the current-buffer isn't
>     remote, the initial value must be chosen from the different remote
>     connections which exist. There can be several ones.
>
> I was imagining running the command in a non-tramp buffer would result
> in an error.  

No. You can give any existing remote connection as SOURCE. The default
directory of current-buffer might just be used as initial value in the
prompt, if possible.

> But now that I think of it, if you are visiting files at 10 different
> hosts, and *all* now need to be redirected through a new hop (for
> example), you might in fact prefer to rename all at once.  

That's another use case. Let's start with the simple case, rename one
connection to another one. That's tricky enough.

If we want to rename several connections at once, we might introduce
another command, which uses the first command as working horse. I could
even think of using regular expressions as SOURCE.

>     Of course, the implementation for the completion of the longest
>     prefix must be written newly as well, because the existing
>     completion functions won't work (badhost is not reachable
>     anymore).
>
> This is really important.  Ido and other aggressive completion tools
> seem to be good at hanging tramp when a host is no longer reachable.
> Since presumably the new command will be used when the host is no
> longer contactable, completion that visits the bad host has to be
> avoided.

Yes. Technically, Tramp must let-bind `non-essential' to t in this
case. This is an established technique, and Tramp uses it already at
other places, in order to calm down eager completion functions.

>     `tramp-rename-host-files' does not fit. The remote part
>     distinguishes not only by host names, but also method and user
>     names. What about `tramp-rename-remote-files'?
>
> That’s good.  Though maybe confusing if people imagine it would rename
> the file locally on disk?  Perhaps `tramp-edit-host-filepaths`?  

I do not want to have "host" in the function name. As said, "host" is
not sufficient to determine another remote connection. You need at least
also method and user.

> That name also gives me the idea for an alternative interface (picking
> up on your multiple steps approach):
>
> * Find all unique `/method1:host|method2:hop1…` values across all
>   tramp buffers
> * `tramp-edit-host-files` would invoke a two stage input:
>
> 1 Prompt 1: Choose host to edit (empty for all hosts, use completion
>   with unique list from #1)
> 2 Prompt 2: /method:host|method2:hop1…:/longest/prefix/path.  Edit
>   this to replace the longest prefix path and hostname, etc.
>
> * If empty (all hosts): Repeat Prompt 2 for all hosts in the unique
>   list above.
> * If not empty (particular host): Present 2nd prompt only for that
>   host
> * tramp-cleanup all edited buffers.
>
> This would even let you change just method all at once.

Let's put it back until we have the basic functionality, renaming one
remote connection to another one. I'm even not certain how this basic
command will work; I'm experimenting.

> Great.  BTW, I see that tramp has a newer version on ELPA, but this
> does not show via `package-list-packages`.  Is tramp being officially
> distributed as an ELPA package now?

Yesm Tramp is distributed via GNU ELPA. I'm putting there a new version
every mont or so; the most recent one is Tramp 2.4.2.4 from last week.

`package-list-packages' shows it twice, the version from GNU ELPA, and
the built-in version from your Emacs. You are invited to install the
version from GNU ELPA, if you don't run Emacs 27.0.50 (the development
version).

I hope to have a first version of tramp-rename-remote-files ready this
week, for playing. I would post a patch here, on top of Tramp 2.4.2.4.

> Best,
>
> JD

Best regards, Michael.



reply via email to

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