* bug#59194: 29.0.50; Tramp autoloads and ordering
@ 2022-11-11 14:07 Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-18 20:19 ` Michael Albinus
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-11-11 14:07 UTC (permalink / raw)
To: 59194
Package: Emacs
Version: 29.0.50
`tramp.el` has the following:
;;;###tramp-autoload
(progn
(defvar tramp--startup-hook nil
"Forms to be executed at the end of tramp.el.")
(put 'tramp--startup-hook 'tramp-suppress-trace t)
(defmacro tramp--with-startup (&rest body)
"Schedule BODY to be executed at the end of tramp.el."
`(add-hook 'tramp--startup-hook (lambda () ,@body))))
and then various other Tramp files have autoloaded forms like:
;;;###tramp-autoload
(tramp--with-startup
(add-to-list 'tramp-methods
...))
The problem here is that the resulting `tramp-loaddefs.el` may or may
not be valid depending on the order in which it gets filled, which is
not something that's documented/guaranteed.
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#59194: 29.0.50; Tramp autoloads and ordering
2022-11-11 14:07 bug#59194: 29.0.50; Tramp autoloads and ordering Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-11-18 20:19 ` Michael Albinus
2022-11-18 21:16 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 3+ messages in thread
From: Michael Albinus @ 2022-11-18 20:19 UTC (permalink / raw)
To: 59194; +Cc: monnier
Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:
Hi Stefan,
> `tramp.el` has the following:
>
> ;;;###tramp-autoload
> (progn
> (defvar tramp--startup-hook nil
> "Forms to be executed at the end of tramp.el.")
> (put 'tramp--startup-hook 'tramp-suppress-trace t)
>
> (defmacro tramp--with-startup (&rest body)
> "Schedule BODY to be executed at the end of tramp.el."
> `(add-hook 'tramp--startup-hook (lambda () ,@body))))
>
> and then various other Tramp files have autoloaded forms like:
>
> ;;;###tramp-autoload
> (tramp--with-startup
> (add-to-list 'tramp-methods
> ...))
>
> The problem here is that the resulting `tramp-loaddefs.el` may or may
> not be valid depending on the order in which it gets filled, which is
> not something that's documented/guaranteed.
I'm aware of this. It was already reported on emacs-devel, see thread
starting with <87edvw7bjk.fsf@dataswamp.org>. In that case I've added
some variable declarations.
However, I don't know how to fix this in general.
> Stefan
Best regards, Michael.
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#59194: 29.0.50; Tramp autoloads and ordering
2022-11-18 20:19 ` Michael Albinus
@ 2022-11-18 21:16 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 0 replies; 3+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-11-18 21:16 UTC (permalink / raw)
To: Michael Albinus; +Cc: 59194
>> `tramp.el` has the following:
>>
>> ;;;###tramp-autoload
>> (progn
>> (defvar tramp--startup-hook nil
>> "Forms to be executed at the end of tramp.el.")
>> (put 'tramp--startup-hook 'tramp-suppress-trace t)
>>
>> (defmacro tramp--with-startup (&rest body)
>> "Schedule BODY to be executed at the end of tramp.el."
>> `(add-hook 'tramp--startup-hook (lambda () ,@body))))
>>
>> and then various other Tramp files have autoloaded forms like:
>>
>> ;;;###tramp-autoload
>> (tramp--with-startup
>> (add-to-list 'tramp-methods
>> ...))
>>
>> The problem here is that the resulting `tramp-loaddefs.el` may or may
>> not be valid depending on the order in which it gets filled, which is
>> not something that's documented/guaranteed.
>
> I'm aware of this. It was already reported on emacs-devel, see thread
> starting with <87edvw7bjk.fsf@dataswamp.org>. In that case I've added
> some variable declarations.
>
> However, I don't know how to fix this in general.
Can you arrange to load `tramp-loaddefs.el` only after some
initialization (e.g. creation of `tramp-foo-methods` or equivalent) so
you can do just:
;;;###tramp-autoload
(add-to-list 'tramp-foo-methods ...)
If those methods really need to be registered later, then `tramp.el` can
finish with a short loop moving the methods from `tramp-foo-methods` to
`tramp-methods`.
Would that make sense?
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-18 21:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-11 14:07 bug#59194: 29.0.50; Tramp autoloads and ordering Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-18 20:19 ` Michael Albinus
2022-11-18 21:16 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).