Subject: Re: bug#51386: 29.0.50; fido-vertical-mode: ssh host completion

From: Gregory Heytings <[email-masked]>
Date: Mon, 25 Oct 2021 16:13:20 +0000

>
> It doesn't seem to work, though. From emacs -Q:
>

Tramp doesn't behave as expected with only flex in completion-styles, 
indeed.  I see the same problem in Emacs 27.  Your bug report was similar 
to bug#50387, it is in fact related but subtly different.

>
> The hostname isn't completed and I don't see the *Completions* buffer. 
> While without enabling fido-vertical-mode, I get /ssh:server on pressing 
> TAB after /ssh:s
>

I'd suggest to add something a fallback method in 
icomplete--fido-mode-setup, for example completion-styles '(flex basic). 
And perhaps to apply the attached patch in your local Emacs, which 
provides I think the behavior you expect.

From 5f4b821bbf5123422d43895bee4c847cfadf31b0 Mon Sep 17 00:00:00 2001
From: Gregory Heytings <[email-masked]>
Date: Mon, 6 Sep 2021 20:52:21 +0000
Subject: [PATCH] Improve handling of non-default completion styles with Tramp
 methods

* lisp/net/tramp.el (tramp-completion-handle-file-name-all-completions):
Do not return methods when the filename already contains a complete method.
Fixes bug#50387.
---
 lisp/net/tramp.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 4fd7a322d4..259fc1fcfc 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2839,8 +2839,9 @@ tramp-completion-handle-file-name-all-completions
 			       (delq nil all-user-hosts)))))
 
 	    ;; Possible methods.
-	    (setq result
-		  (append result (tramp-get-completion-methods m)))))))
+	    (unless (string-empty-p method)
+	      (setq result
+		    (append result (tramp-get-completion-methods m))))))))
 
     ;; Unify list, add hop, remove nil elements.
     (dolist (elt result)
-- 
2.33.0