Open olessavluk opened 6 years ago
I've tried to rewrite function for suggestions using process-file
which is aware of the default-directory
which means it can be used over tramp:
(defun docker-tramp--running-containers ()
"Collect docker running containers.
Return a list of containers of the form: \(ID NAME\)"
(let* ((args (append docker-tramp-docker-options
(list "ps" "--format" "{{.ID}}:{{.Names}}")))
(ps (ignore-errors
(with-output-to-string
(apply #'process-file docker-tramp-docker-executable nil standard-output nil args))))
(lines (split-string ps))
(split-by-collon (lambda (str) (split-string str ":"))))
(mapcar split-by-collon lines)))
full source - https://github.com/olessavluk/docker-tramp.el/blob/multi-hops/docker-tramp.el#L101
But with this changes, when I use multi-hops syntax I still see my local containers. And after I open some file or a dired buffer using ssh
method of TRAMP - I see containers from the remote machine. Which is better but not the desired behavior.
Maybe I can somehow get currently entered value e.g. /ssh:example.com|docker
and use it as default-directory
and use it to specify which docker
whould be executed?
Hi, sorry for the late response. I remember also trying to make this work. I patched process-lines
to use process-file
instead of call-process
which is somewhat similar to your patch, but still tramp does not call the completion functions on the remote server. IIRC tramp-completion-dissect-file-name
, the function in charge of filename completions, does not seem to work with hops.
I'll try to check this again this weekend, you can also ask in the tramp mailing list btw.
Any update on this function?
Hello @stardiviner, As @marsam pointed, seems like there is no way to do this without patching emacs, but I should ask somewhere first.
As a temporary workaround I'm using my fork olessavluk/docker-tramp branch:multi-hops. It is aware of the TRAMP but not aware of the multi-hops (as I've describe previously). In order to use it:
dotspacemacs-additional-packages
:
(docker-tramp :location (recipe :fetcher github :repo "olessavluk/docker-tramp.el" :branch "multi-hops"))
dired
buffer@olessavluk Thanks.
Hi @olessavluk, Can you make a PR? It is better than current behavior anyway. It is quite common to open a dired buffer or file on a remote host (e.g. via bookmark) and then add hop to the path.
Hi,
Maybe I can somehow get currently entered value e.g.
/ssh:example.com|docker
and use it asdefault-directory
and use it to specify whichdocker
whould be executed?
I did exactly that by using (minibuffer-contents-no-properties)
and it works for me. Check out PR #36 when you have time!
Hi,
When I use TRAMP multi-hops syntax, for example
/ssh:example.com|docker:
in the suggestions, I see the list of my local containers, but would like to see the remote one (from example.com).Is it possible to make suggestions that use remote docker?