Michael Albinus <michael.albi...@gmx.de> writes: > Eshel Yaron <m...@eshelyaron.com> writes: > >> 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.
In my second suggestion I didn't use tramp-enable-*-method, but a new convention tramp-*-method-params, so there's no such risk. Anyway, these are just examples of possible ways to facilitate lazy loading. >>>> 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 > > ;;;###autoload > (with-eval-after-load 'tramp > (tramp-enable-method "foo")) > > instead. Everything untested, of course. This is more or less what the extensions you referred to seem to do. I'm looking for a more refined solution: a way to load an extension only if and when the method it provides is actually used, not as soon as Tramp is loaded. I might indeed use this approach until I find something better, though. Best, Eshel