Subject: Re: bug#78844: 30.1; feature request: public interface for querying builtin packages and versions

From: Xiyue Deng <[email-masked]>
Date: Sun, 22 Jun 2025 14:51:48 -0700

Eli Zaretskii <[email-masked]> writes:

>> Cc: [email-masked]
>> From: Xiyue Deng <[email-masked]>
>> Date: Fri, 20 Jun 2025 21:43:09 -0700
>> 
>> Hi Sean,
>> 
>> Sean Whitton <[email-masked]> writes:
>> 
>> > Hello,
>> >
>> > It would be great to stabilise this interface.  We would like to add
>> > package system metadata to the Emacs packages in Debian to track all the
>> > built-in packages.  We could do various useful things with that.
>> >
>> > Thanks to Xiyue for working on this, both here and over in the Debian
>> > BTS.  The sample interface looks good to me.
>> >
>> 
>> Thanks for pre-approving!  I have attached a draft patch for adding
>> those functions.  A slight change is to query `package--builtins' for
>> builtin package names as it contains a larger list of builtin packages
>> that may not have a version defined in `package--builtin-versions'.  I
>> also dropped "get" from the function names as it seems not to have been
>> used in the current code base.
>> 
>> Also, for completeness, I actually find there is a `package-built-in-p'
>> function for checking built-in packages.  But there is no way to get a
>> complete list of builtin packages, so package-builtin-packages is still
>> needed.  I also don't check whether a package is builtin in the added
>> `package-builtin-package-version' function and return nil for both
>> non-builtin packages and builtin packages without a version, as we can
>> use `package-built-in-p' to check the former.
>
> Thanks, I added the relevant individuals to this discussion.

Thanks Eli!

One thing I noticed when testing was that `package--builtins' was not
populated on startup.  According to the doc, the value is initialized
when `finder-inf' is loaded.  Locally I just use `(require 'finder-inf)'
before using `package--builtins' as a workaround.  Is there a better
way?

-- 
Regards,
Xiyue Deng