Hi, 

Andrea is right. Reading through all the documentation, I implied
that use-package would upgrade built-in packages if I pinned them to an archive
and I :ensure'd them. 

Use case: want to upgrade org from the 9.6.x version packaged with master to the
9.7.x version available in elpa. 

Maybe this is more a FR and if so, we could move this to the list and have an informed 
discussion there.

Best, /PA

On Wed, 5 Jun 2024 at 20:09, Andrea Corallo <acorallo@gnu.org> wrote:
Eli Zaretskii <eliz@gnu.org> writes:

>> Cc: 71356@debbugs.gnu.org
>> From: Andrea Corallo <acorallo@gnu.org>
>> 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



--
Fragen sind nicht da, um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run a leader-deposed hook here, but we can't yet