From d22fa5a67014f49c1e6b732bbde7737fe9e2f33f Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 20 Mar 2024 03:09:05 -0400 Subject: [PATCH] fix(vertico): consult-dir: don't guess user from containers The tramp string used to connect to the container uses the first `container-runtime ps` argument as a username, but the first argument returned is the container ID, not a username. Close: #7674 Co-authored-by: bergmannf Co-authored-by: elken --- modules/completion/vertico/config.el | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/completion/vertico/config.el b/modules/completion/vertico/config.el index e15bd0fb7..cce40e94f 100644 --- a/modules/completion/vertico/config.el +++ b/modules/completion/vertico/config.el @@ -201,7 +201,8 @@ orderless." ("C-x C-j" . consult-dir-jump-file)) :config (when (modulep! :tools docker) - ;; TODO Replace with `tramp-container--completion-function' when we drop support for <29 + ;; TODO: Replace with `tramp-container--completion-function' when we drop + ;; support for <29 (defun +vertico--consult-dir-container-hosts (host) "Get a list of hosts from HOST." (cl-loop for line in (cdr @@ -209,10 +210,7 @@ orderless." (apply #'process-lines +vertico-consult-dir-container-executable (append +vertico-consult-dir-container-args (list "ps"))))) for cand = (split-string line "[[:space:]]+" t) - collect (let ((user (unless (string-empty-p (car cand)) - (concat (car cand) "@"))) - (hostname (car (last cand)))) - (format "/%s:%s%s:/" host user hostname)))) + collect (format "/%s:%s:/" host (car (last cand))))) (defun +vertico--consult-dir-podman-hosts () (let ((+vertico-consult-dir-container-executable "podman"))