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

From: Gregory Heytings <[email-masked]>
Date: Mon, 06 Sep 2021 21:39:06 +0000

>
> The completion tables's API only directly support prefix completion. So 
> in order to implement `substring` style, when the minibuffer.el code 
> sees a request for completion of "/a" it will request all the possible 
> prefix-completions for "/" and then filter them based on the presence of 
> "a" in there.
>

Thank you.  Now I understand the bug better: when the user types / TAB, 
Tramp returns the default methods (scp: scpx:), when the user types /sc 
TAB, Tramp returns the methods starting with 'sc', i.e. scp: scpx:, and 
when the user types /scp: TAB, Tramp again returns the default methods 
scp: scpx:, because it is again at '/', and the substring completion 
backend concludes that "scp:" cannot be completed further, which is wrong.

With my patch, when the user types / TAB, Tramp does not return the 
default methods anymore, and therefore they are not returned after /scp: 
TAB either.  So IMO the patch does TRT, and fixes both the behavior with 
substring and flex completion styles.