Subject: [PATCH] Support displaying all package maintainers
From: Jonas Bernoulli <[email-masked]>
To: [email-masked]
Cc: [email-masked], [email-masked]
Date: Wed, 29 Mar 2023 17:32:14 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

If the package's new `:maintainers' extra property is non-nil, then
display all of the specified maintainers, if any, like we already
do for `:authors'.  If the value is nil, then fall back to the old
`:maintainer' property.

We cannot just allow the existing `:maintainer' property to be a
list of maintainers, because that would break older versions of this
function.  We also cannot just ignore `:maintainer', because all ELPAs
still have to be updated to include `:maintainers' in archive-contents.

Even once all ELPAs have been updated to include `:maintainers', they
have to continue to also include `:maintainer', for the benefit of
older versions of this function / package.el / Emacs.  To avoid this
duplication, `package' would have to be distributed on GNU ELPA as a
"core" package.

* lisp/emacs-lisp/package.el (describe-package-1): Use new
:maintainers package extra property from "archive-contents,
if non-nil.
---
 lisp/emacs-lisp/package.el | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index f92afe56b76..487dfac252f 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2696,7 +2696,8 @@ describe-package-1
          (status (if desc (package-desc-status desc) "orphan"))
          (incompatible-reason (package--incompatible-p desc))
          (signed (if desc (package-desc-signed desc)))
-         (maintainer (cdr (assoc :maintainer extras)))
+         (maintainers (or (cdr (assoc :maintainers extras))
+                          (cdr (assoc :maintainer extras))))
          (authors (cdr (assoc :authors extras)))
          (news (and-let* (pkg-dir
                           ((not built-in))
@@ -2831,19 +2832,21 @@ describe-package-1
          'action 'package-keyword-button-action)
         (insert " "))
       (insert "\n"))
-    (when maintainer
-      (package--print-help-section "Maintainer")
-      (package--print-email-button maintainer))
-    (when authors
+    (when maintainers
+      (unless (car-safe (car maintainers))
+        (setq maintainers (list maintainers)))
       (package--print-help-section
-          (if (= (length authors) 1)
-              "Author"
-            "Authors"))
-      (package--print-email-button (pop authors))
-      ;; If there's more than one author, indent the rest correctly.
-      (dolist (name authors)
-        (insert (make-string 13 ?\s))
-        (package--print-email-button name)))
+          (if (cdr maintainers) "Maintainers" "Maintainer"))
+      (dolist (maintainer maintainers)
+        (when (bolp)
+          (insert (make-string 13 ?\s)))
+        (package--print-email-button maintainer)))
+    (when authors
+      (package--print-help-section (if (cdr authors) "Authors" "Author"))
+      (dolist (author authors)
+        (when (bolp)
+          (insert (make-string 13 ?\s)))
+        (package--print-email-button author)))
     (let* ((all-pkgs (append (cdr (assq name package-alist))
                              (cdr (assq name package-archive-contents))
                              (let ((bi (assq name package--builtins)))
-- 
2.39.2