tramp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Provide completion candidates for remote containers over a T


From: Michael Albinus
Subject: Re: [PATCH] Provide completion candidates for remote containers over a TRAMP connection
Date: Tue, 29 Aug 2023 11:56:28 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Gene Goykhman <gene@indigo1.com> writes:

> Hi Michael,

Hi Gene,

> I have also incorporated your other suggestions and added a `defcustom
> tramp-completion-remote-containers' to allow the user to turn this
> feature on. It is off by default, but I can change this if you feel it
> appropriate.

Well, yes. I believe we could use a better name for it, because the
feature is not restricted to container methods. It could be added for
any method; it just needs to adapt the respective completion
function. A name like tramp-completion-use-ad-hoc-proxies? Perhaps you
have a better proposal; I'm notoriously bad in finding good names.

I'm kind of undecided what the default should be. nil is conservative,
no surprise of users. OTOH, this new feature will remain undetected by
the majority of users, if we don't peopagate it accordingly (for
example, enabling it by default :-)

For the futere I could imagine more different values. t and nil are fine
ATM, but if there are more methods which support this feature, it could
be a list. '("docker" "podman" "kubernetes") would enable this for the
respective methods, and disable it for all other methods in multi-hop
completions. WDYT?

> I have attached the patch in its current form. Note that this patch is
> now made against the tramp.git repository... my original patch was
> against the main Emacs repository.

Tramp repo is OK. All my development happens there. Mostly, I keep the
Tramp and Emacs repos in sync, but sometimes, when a new feature is
under development, I delay the sync.

I've pushed your patch to both the Tramp and Emacs repos. I've added
another patch afterwards, most of it are minor changes. The change which
matters is in tramp-container--completion-function. I've changed the
argument to METHOD, by this we avoid the problem in
tramp-set-completion-function checking the argument properly. Furthermore,
non-essential is bound to nil here. During completion, it is usually
bound to t, in order to suppress opening a new connection. But here, we
*want* the new connection, therefore this change. Now you can do something like

C-x C-f /ss TAB : <host> TAB | TAB doc TAB TAB

without to connect to any host explicitly in advance.

Furthermore, the result of tramp-container--completion-function is
cached now. I've obeserved that the function is called 5 times in a row;
we don't need so many shells to be applied on remote.

What you could perhaps contribute is documentation of
tramp-completion-remote-containers (with its changed name) in
tramp.texi. Maybe in node "Ad-hoc multi-hops"?

And also a short entry for Emacs' etc/NEWS file would be great.

Best regards, Michael.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]