tramp-devel
[Top][All Lists]
Advanced

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

Re: How to autoload Tramp methods


From: Michael Albinus
Subject: Re: How to autoload Tramp methods
Date: Tue, 08 Oct 2024 21:17:34 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Eshel Yaron <me@eshelyaron.com> writes:

> Hi Michael,

Hi Eshel,

>> As said above, tramp-dissect-file-name is such an essential function in
>> Tramp, that I won't add unrelated functionality. I fear collateral
>> damages, and yes, this happened in the past already.
>
> OK, but since this function asserts that a method is known and throws an
> error otherwise, it seems like it's the only place that an extension
> could hook into to be loaded just in time.

One possible collateral damage is, that your patch could call one of the
existing tramp-enable-*-method, like tramp-enable-toolbox-method, even if
it is not intended. Too much trouble.

>>> Interesting, wouldn't autoloading the call to tramp-enable-method end up
>>> loading Tramp to define tramp-enable-method during Emacs start up?
>>
>> Yes, it would load tramp.el. But this is needed anyway, if you want
>> Emacs to detect "/foo:host:/path/to/file" as remote file name.
>
> Unfortunately loading Tramp at start up is not really viable.  I don't
> think it's necessary either: tramp-autoload-file-name-handler is in
> file-name-handler-alist after start up, so Emacs does recognize
> "/foo:host:/..." as a remote file name, and loads Tramp when needed.

Then use

--8<---------------cut here---------------start------------->8---
;;;###autoload
(with-eval-after-load 'tramp
  (tramp-enable-method "foo"))
--8<---------------cut here---------------end--------------->8---

instead. Everything untested, of course.

> Thanks for your help,
>
> Eshel

Best regards, Michael.



reply via email to

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