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

From: Michael Albinus <[email-masked]>
Date: Mon, 06 Sep 2021 10:18:43 +0200

Gregory Heytings <[email-masked]> writes:

Hi Gregory,

> I analyzed this bug a bit further, and the root problem is that
>
> (tramp-completion-handle-file-name-all-completions "" "/")
>
> returns ("sshfs:" "ssh:" "sshx:" ...) when tramp-default-method is
> "ssh", and ("scp:" "scpx:" ...) when tramp-default-method is "scp".
>
> This happens because "possible methods" are added to the result in
> tramp-completion-handle-file-name-all-completions.
>
> Therefore completion-substring-try-completion finds that "ssh:" is
> already a complete match.
>
> I'm not sure how this bug should be fixed.  Removing these two lines
> from that function fixes the bug, but that's not really optimal
> because in that case /s TAB does not show "ssh:", "sshfs:" and "sshx:"
> anymore.  Not displaying these completions is perhaps better than not
> displaying hostnames, however.

Tramp doesn't know anything about completion-styles, it just implements
file-name-all-completions and file-name-completion. Cutting valid
results from those functions seems to be wrong, IMO.

Best regards, Michael.