Subject: Re: bug#71356: use-package doesn't load org from elpa

From: Andrea Corallo <[email-masked]>
Date: Wed, 05 Jun 2024 14:09:22 -0400

Eli Zaretskii <[email-masked]> writes:

>> Cc: [email-masked]
>> From: Andrea Corallo <[email-masked]>
>> Date: Tue, 04 Jun 2024 17:44:37 -0400
>>
>> Seems the issue is in 'use-package-ensure-elpa' where we gate any
>> installation with "(unless (package-installed-p package)".  I think we
>> should progress also if we see that the package is built-in and is
>> actually pinned.
>>
>> The attached seems to do the job for me, but I'm not 100% sure it's the
>> best/right fix so I'd appretiate someone else to have a look.
>
> Isn't this because we require an explicit directive by the user in
> order to upgrade a built-in package?  The Emacs user manual says:
>
>      By default, ‘package-install’ doesn't consider built-in packages for
>   which new versions are available from the archives.  (A package is
>   built-in if it is included in the Emacs distribution.)  In particular,
>   it will not show built-in packages in the list of completion candidates
>   when you type at its prompt.  But if you invoke ‘package-install’ with a
>   prefix argument, it will also consider built-in packages that can be
>   upgraded.  You can make this behavior the default by customizing the
>   variable ‘package-install-upgrade-built-in’: if its value is non-‘nil’,
>   ‘package-install’ will consider built-in packages even when invoked
>   without a prefix argument.  Note that the package-menu commands (*note
>   Package Menu::) are also affected by ‘package-install-upgrade-built-in’.
>
>      By contrast, ‘package-upgrade’ and ‘package-upgrade-all’ never
>   consider built-in packages.  If you want to use these commands for
>   upgrading some built-in packages, you need to upgrade each of those
>   packages, once, either via ‘C-u M-x package-install <RET>’, or by
>   customizing ‘package-install-upgrade-built-in’ to a non-‘nil’ value, and
>   then upgrading the package once via the package menu or by
>   ‘package-install’.
>
> We had a long (and somewhat heated) discussion about this a year ago,
> see bug#62720.

I see thanks, OTOH this report is about the use-package macro not
package itself.

use-package doc doesn't mention built-in packages, but describes the two
keyword parameters as:

:ensure          Loads the package using package.el if necessary.
:pin             Pin the package to an archive.

So I found reasonable that for the reported case the user expects the
package to be loaded using package.el.  But as I mentioned I'm no expert
in this area so I might very well be off :)

Thanks

  Andrea