Subject: Re: bug#50387: Possible bug in Tramp or in completions

From: Michael Albinus <[email-masked]>
Date: Wed, 08 Sep 2021 09:26:54 +0200

Gregory Heytings <[email-masked]> writes:

>>
>> I will, when I'm convinced the current situation isn't
>> acceptable. The current situation (you must type a char in order to
>> see the host name) is described in the Tramp manual, and I haven't
>> heard complaints about since ever.
>>
>
> That might be what the manual says, but it's not what the current
> situation actually is.  Type C-x C-f /scp TAB and you'll see scp:
> scpx:.

Sure. Completion style `substring' is not active, and so we see in the
traces buffer

--8<---------------cut here---------------start------------->8---
======================================================================
1 -> (tramp-completion-handle-file-name-all-completions "scp" "/")
1 <- tramp-completion-handle-file-name-all-completions: ("scp:" "scpx:")
======================================================================
1 -> (tramp-completion-handle-file-name-all-completions "scp" "/")
1 <- tramp-completion-handle-file-name-all-completions: ("scp:" "scpx:")
--8<---------------cut here---------------end--------------->8---

See, how `tramp-completion-handle-file-name-all-completions' is invoked
differently.

> Type C-x C-f /scp: TAB and you'll see scp:foo: scp:bar:.  This
> is coherent, ':' acts like a directory separator, like the '://' in
> URLs.

The traces show us

--8<---------------cut here---------------start------------->8---
======================================================================
1 -> (tramp-completion-handle-file-name-all-completions "scp:" "/")
1 <- tramp-completion-handle-file-name-all-completions: ("scp:test:" ... "scp:osboxes@")
======================================================================
1 -> (tramp-completion-handle-file-name-all-completions "scp:" "/")
1 <- tramp-completion-handle-file-name-all-completions: ("scp:test:" ... "scp:osboxes@")
--8<---------------cut here---------------end--------------->8---

(I've cut the result of the function, you don't want to see the zillions
of possible completions in my stanza :-) Again, see the arguments the
function is called with.

> But for those who use the substring and flex completion styles, typing
> C-x C-f /scp TAB displays pscp: scp: scpx:.  Typing C-x C-f /scp: TAB
> still displays scp: scpx:.  This isn't at all coherent.

I've said it several times: `tramp-completion-handle-file-name-all-completions'
is called with arguments, and it returns a corresponding result. It is
consistent. How completion styles interpret the result, is out of
Tramp's responsibility.

I don't say there's no bug. But as Tramp maintainer I believe there is
no bug in Tramp (anymore); I have no knowledge of completion styles in
order to help fixing it there.

Best regards, Michael.