Subject: bug#72453: 29.4; "use-package" macro does not load all expected related files

From: Derek Upham <[email-masked]>
Date: Sun, 18 Aug 2024 18:26:22 -0700

Stefan Kangas <[email-masked]> writes:

>>  Warning (emacs): use-package-ensure-trace files (t) nil
>>  Warning (emacs): use-package-ensure-trace rx (t) nil
>>  Warning (emacs): use-package-ensure-trace avoid (t) nil
>
> Thanks for the bug report and the clear recipe to reproduce it.
>
> I can reproduce this bug here also.
>
>> Moving the "use-package" macro into the top-level "use-package" 
>> file
>> should fix the problem.  The "use-package" file explicitly 
>> loads the
>> other files, which sets up all of the defaults.
>
> The attached less intrusive patch fixes it here.  Could you 
> please test
> that it fixes the problem for you?

Validating on stock 29.4, with this command:

   ~/emacs-29.4/bin/emacs --init-directory use-package-ensure-test

and this test code:

 (defun use-package-ensure-trace (name args state)
   (warn "use-package-ensure-trace %s %s %s" name args state)
   t)

 ;;(require 'use-package)

 (setq use-package-ensure-function 'use-package-ensure-trace)
 (setq use-package-always-ensure t)

 (use-package faces)
 (use-package ansi-color)
 (use-package files :ensure t)
 (use-package rx)
 (use-package avoid)

I’m seeing the outputs that we expect:

 Warning (emacs): use-package-ensure-trace faces (t) nil
 Warning (emacs): use-package-ensure-trace ansi-color (t) nil
 Warning (emacs): use-package-ensure-trace files (t) nil
 Warning (emacs): use-package-ensure-trace rx (t) nil
 Warning (emacs): use-package-ensure-trace avoid (t) nil

Thanks for working on this.

-- 
Derek Upham
[email-masked]