Subject: bug#15112: 24.3; package.el byte compile autoloads

From: Stefan Kangas <[email-masked]>
Date: Wed, 25 Nov 2020 21:44:41 -0500

Noam Postavsky <[email-masked]> writes:

> Stefan Kangas <[email-masked]> writes:
>
>> package-autoload-ensure-default-file now uses autoload-rubric internally
>> and no longer contains the line quoted above with "no-byte-compile".
>> However, autoload-rubric still contains it.
>>
>> I guess the question is if it's there for good reason or could perhaps
>> be omitted.  If there's a good reason for it, perhaps this bug should be
>> closed as wontfix.
>>
>> Noam, I noted that you added a comment to this particular line recently
>> in commit 1f7b602f84.  Could you perhaps shed some light on why we use
>> no-byte-compile here?
>
> As the comment says "#$ is byte-compiled into nil", and we use #$ in the
> generated autoloaded file.  So byte-compiling would break it.
>
> I think it would work to use load-file-name instead.

I made a little experiment and of course byte-compiling these files
gives us a ton of headaches, see below.  So I'm not sure this is all
worth it.  Do we have reason to believe that byte-compiling these files
would give any significant performance increase?

  ELC      net/tramp-loaddefs.elc

In toplevel form:
net/tramp-loaddefs.el:28:36: Warning: reference to free variable
    ‘tramp-methods’
net/tramp-loaddefs.el:28:36: Warning: assignment to free variable
    ‘tramp-methods’
net/tramp-loaddefs.el:28:217: Warning: reference to free variable
    ‘tramp-default-host-alist’
net/tramp-loaddefs.el:28:217: Warning: assignment to free variable
    ‘tramp-default-host-alist’
net/tramp-loaddefs.el:361:175: Warning: reference to free variable
    ‘tramp-default-method-alist’
net/tramp-loaddefs.el:361:175: Warning: assignment to free variable
    ‘tramp-default-method-alist’
net/tramp-loaddefs.el:373:36: Warning: reference to free variable
    ‘tramp-foreign-file-name-handler-alist’
net/tramp-loaddefs.el:373:36: Warning: assignment to free variable
    ‘tramp-foreign-file-name-handler-alist’
  ELC      net/tramp-rclone.elc
net/tramp-loaddefs.el:521:7366: Warning: reference to free variable
    ‘tramp-local-host-regexp’
net/tramp-loaddefs.el:521:7424: Warning: reference to free variable
    ‘tramp-default-user-alist’
  ELC      net/tramp-sh.elc
net/tramp-loaddefs.el:521:7541: Warning: assignment to free variable
    ‘tramp-default-user-alist’

In end of data:
net/tramp-loaddefs.el:768:1: Warning: the following functions are not known to
    be defined: tramp--with-startup, tramp-set-completion-function,
    tramp-tramp-file-p, tramp-file-name-method, tramp-dissect-file-name,
    tramp-register-foreign-file-name-handler, tramp-compat-file-name-quoted-p
  ELC      net/tramp-smb.elc
  ELC      net/tramp-sudoedit.elc
  ELC      net/tramp-uu.elc
  ELC      net/tramp.elc

In toplevel form:
net/tramp-rclone.el:39:1: Error: Symbol’s value as variable is void:
tramp-methods
make[3]: *** [Makefile:295: net/tramp-rclone.elc] Error 1
make[3]: *** Waiting for unfinished jobs....

In toplevel form:
net/tramp-sh.el:35:1: Error: Symbol’s value as variable is void: tramp-methods
make[3]: *** [Makefile:295: net/tramp-sh.elc] Error 1

In toplevel form:
net/tramp-smb.el:31:1: Error: Symbol’s value as variable is void: tramp-methods
make[3]: *** [Makefile:295: net/tramp-smb.elc] Error 1

In toplevel form:
net/tramp-sudoedit.el:37:1: Error: Symbol’s value as variable is void:
tramp-methods
make[3]: *** [Makefile:295: net/tramp-sudoedit.elc] Error 1

In toplevel form:
net/tramp.el:89:1: Error: Symbol’s value as variable is void: tramp-methods
make[3]: *** [Makefile:295: net/tramp.elc] Error 1
make[3]: Leaving directory '/home/skangas/wip/emacs/lisp'
make[2]: *** [Makefile:318: compile-main] Error 2
make[2]: Leaving directory '/home/skangas/wip/emacs/lisp'
make[1]: *** [Makefile:411: lisp] Error 2
make[1]: Leaving directory '/home/skangas/wip/emacs'
make: *** [Makefile:1126: bootstrap] Error 2