Hi Michael,

Michael Albinus <michael.albi...@gmx.de> wrote:

> > I think this is a great idea. What about calling the variable
> > `tramp-completion-multi-hop-methods', with a default of '("docker"
> > "podman")? I am not confident including "kubernetes" here as I have
> > not tested it but could do so if you are comfortable with that.

> Sounds OK to me.

Great... I've attached a patch that makes this change to current TRAMP master.

> > I'll get started on this and an addition to etc/NEWS about the new user 
> > option.

I'm still working on the update to the NEWS file and addition to the .texi... 
updates soon!

>From 7ab00891e4e177170a184027019f5ef1d9ee2eca Mon Sep 17 00:00:00 2001
From: Gene Goykhman <g...@indigo1.com>
Date: Thu, 31 Aug 2023 10:05:13 -0400
Subject: [PATCH] Allow enabling multi-hop container completion selectively by
 method

* tramp.el: add custom variable tramp-container-multi-hop-methods
* tramp-container.el: check if METHOD is a member of
tramp-container-multi-hop-methods before attempting completion
---
 lisp/tramp-container.el | 2 +-
 lisp/tramp.el           | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/tramp-container.el b/lisp/tramp-container.el
index 687092e7..a0ed9b71 100644
--- a/lisp/tramp-container.el
+++ b/lisp/tramp-container.el
@@ -166,7 +166,7 @@ METHOD is the Tramp method to be used for \"ps\", either
 This function is used by `tramp-set-completion-function', please
 see its function help for a description of the format."
   (let ((default-directory
-	 (or (and tramp-completion-remote-containers tramp--last-hop-directory)
+	 (or (and (member method tramp-completion-multi-hop-methods) tramp--last-hop-directory)
 	     tramp-compat-temporary-file-directory))
 	(program (tramp-get-method-parameter
 		  (make-tramp-file-name :method method) 'tramp-login-program))
diff --git a/lisp/tramp.el b/lisp/tramp.el
index b34d3ff6..754f135c 100644
--- a/lisp/tramp.el
+++ b/lisp/tramp.el
@@ -3009,8 +3009,8 @@ This function is added always in `tramp-get-completion-function'
 for all methods.  Resulting data are derived from default settings."
   `((,(tramp-find-user method nil nil) ,(tramp-find-host method nil nil))))
 
-(defcustom tramp-completion-remote-containers nil
-  "Whether container hosts in multi-hop paths should be queried for completions."
+(defcustom tramp-completion-multi-hop-methods `(,tramp-docker-method ,tramp-podman-method)
+  "Methods for which to attempt to provide completions over multi-hop connections."
   :version "30.1"
   :type 'boolean)
 
-- 
2.39.2 (Apple Git-143)

Reply via email to