GNU bug report logs - #59194
29.0.50; Tramp autoloads and ordering

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Fri, 11 Nov 2022 14:08:02 UTC

Severity: normal

Found in version 29.0.50

To reply to this bug, email your comments to 59194 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#59194; Package emacs. (Fri, 11 Nov 2022 14:08:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 11 Nov 2022 14:08:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; Tramp autoloads and ordering
Date: Fri, 11 Nov 2022 09:07:06 -0500
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





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59194; Package emacs. (Fri, 18 Nov 2022 20:20:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs <at> gnu.org>
Cc: 59194 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#59194: 29.0.50; Tramp autoloads and ordering
Date: Fri, 18 Nov 2022 21:19:37 +0100
Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs <at> 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 <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59194; Package emacs. (Fri, 18 Nov 2022 20:20:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59194; Package emacs. (Fri, 18 Nov 2022 21:17:02 GMT) Full text and rfc822 format available.

Message #14 received at 59194 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 59194 <at> debbugs.gnu.org
Subject: Re: bug#59194: 29.0.50; Tramp autoloads and ordering
Date: Fri, 18 Nov 2022 16:16:33 -0500
>> `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 <at> 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





This bug report was last modified 1 year and 159 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.