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

From: Gregory Heytings <[email-masked]>
Date: Mon, 06 Sep 2021 20:00:16 +0000

I squashed the bug.  Fix attached.

From efd129044567e2016d19b2a6a2bdf2dc06db9458 Mon Sep 17 00:00:00 2001
From: Gregory Heytings <[email-masked]>
Date: Mon, 6 Sep 2021 19:52:52 +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 | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

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