1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
From 5ad268f00faac747beadf29c4a6216c678764c30 Mon Sep 17 00:00:00 2001
From: Xiyue Deng <manphiz@gmail.com>
Date: Fri, 20 Jun 2025 21:34:45 -0700
Subject: Add public interfaces for accessing builtin package info (Bug#78844)
The following upstream patch has been backported:
Add public interfaces for accessing builtin package info (Bug#78844)
* lisp/emacs-lisp/package.el (package-builtin-packages)
(package-builtin-package-version): New functions.
* doc/lispref/package.texi: Add a section 'Package Information' with
documentation for the new functions.
* etc/NEWS: Add entry for 'package-versioned-builtin-packages' and
'package-builtin-package-version'.
Origin: upstream, commit 5c75ec6ae52a5b06ad0424ce805f5ea0432b6e90
Forwarded: not-needed
---
lisp/emacs-lisp/package.el | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index be3b85f3179..82b7520a707 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -669,6 +669,21 @@ package-alist
loaded and/or activated, customize `package-load-list'.")
(put 'package-alist 'risky-local-variable t)
+;;;; Public interfaces for accessing built-in package info
+
+(defun package-versioned-builtin-packages ()
+ "Return a list of all the versioned built-in packages.
+The return value is a list of names of built-in packages represented as
+symbols."
+ (mapcar #'car package--builtin-versions))
+
+(defun package-builtin-package-version (package)
+ "Return the version of a built-in PACKAGE given by its symbol.
+The return value is a list of integers representing the version of
+PACKAGE, in the format returned by `version-to-list', or nil if the
+package is built-in but has no version or is not a built-in package."
+ (alist-get package package--builtin-versions))
+
;;;###autoload
(defvar package-activated-list nil
;; FIXME: This should implicitly include all builtin packages.
|