Subject: Re: bug#61802: 29.0.60; Packages supporting "package.el" throw comp warnings when package.el not loaded

From: Stefan Kangas <[email-masked]>
Date: Sun, 1 Oct 2023 05:36:38 -0700

tags 61802 notabug
close 61802
thanks

Chris Brolly <[email-masked]> writes:

> When packages are built (using straight-use-package) with native-comp
> enabled, many result in the warning such as the one resulting from magit
> being compiled below:
>     Warning (comp): magit-section-pkg.el:1:2: Warning: the function
>             'define-package' is not known to be defined.
>     Warning (comp): git-commit-pkg.el:1:2: Warning: the function
>             'define-package' is not known to be defined.
>     Warning (comp): magit-section-pkg.el:1:2: Warning: the function
>             'define-package' is not known to be defined.
>     Warning (comp): magit-pkg.el:1:2: Warning: the function
>             'define-package' is not known to be defined.
> This will happen after the initial straight.el build process is
> completed.
> I've tried to cut this down, but i was unable to replicate it without
> straight.el. Just using use-package on its own with another package was
> unsuccessful.
>
> (unless (featurep 'straight)
>   ;;(setq straight-repository-branch "rr-fix-renamed-variable")
>   (defvar bootstrap-version)
>   (let ((bootstrap-file
>          (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
>         (bootstrap-version 6))
>     (unless (file-exists-p bootstrap-file)
>       (with-current-buffer
>           (url-retrieve-synchronously
>            "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
>            'silent 'inhibit-cookies)
>         (goto-char (point-max))
>         (eval-print-last-sexp)))
>     (load bootstrap-file nil 'nomessage))
>   (setq my-straight-pkgs
>         '((use-package :type git :host github :repo "jwiegley/use-package")
>           (magit :type git :host github :repo "magit/magit")))
>   (dolist (pkg my-straight-pkgs)
>     (straight-use-package pkg)))
>
> Once run, the warnings begin to pile up over the next few
> minutes. Nothing else untoward seems to happen, but I was recommended to
> report this so here I am.

This is a bug in straight.el, which seems to be compiling "foo-pkg.el"
files.  It should not do that.  I recommend reporting this bug to the
straight.el maintainers.  Meanwhile, I'm closing this bug.

Thanks.