Subject: bug#77075: [PATCH] Prepare package.el to be published on GNU ELPA, [PATCH] Prepare package.el to be published on GNU ELPA

From: Daniel Mendler <[email-masked]>
Date: Mon, 17 Mar 2025 19:39:00 +0100

Hi Philip,

a few comments below.

> diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
> index 8d2e2f09108..7a69e680880 100644
> --- a/lisp/emacs-lisp/package.el
> +++ b/lisp/emacs-lisp/package.el
> @@ -5,9 +5,12 @@
>  ;; Author: Tom Tromey <[email-masked]>
>  ;;         Daniel Hackney <[email-masked]>
>  ;; Created: 10 Mar 2007
> -;; Version: 1.1.0
> +;; Version: 1.1.1-pre
>  ;; Keywords: tools
> -;; Package-Requires: ((tabulated-list "1.0"))
> +;; Package-Requires: ((emacs "26.1") (compat "29"))

I suggest to require the newest Compat 30.

> +;; This is a GNU ELPA :core package.  Avoid functionality that is not
> +;; compatible with the version of Emacs recorded above.
>  
>  ;; This file is part of GNU Emacs.
>  
> @@ -147,6 +150,7 @@
>  (eval-when-compile (require 'subr-x))
>  (eval-when-compile (require 'epg))      ;For setf accessors.
>  (eval-when-compile (require 'inline))   ;For `define-inline'
> +(require 'compat nil 'noerror)
>  (require 'seq)

(require 'compat) without the noerror argument should work, since we
have the compat.el stub in Emacs.

>  (require 'tabulated-list)
> @@ -1151,7 +1155,8 @@ package--native-compile-async
>    "Native compile installed package PKG-DESC asynchronously.
>  This assumes that `pkg-desc' has already been activated with
>  `package-activate-1'."
> -  (when (native-comp-available-p)
> +  (when (and (fboundp 'native-comp-available-p)
> +             (native-comp-available-p))
>      (let ((warning-minimum-level :error))
>        (native-compile-async (package-desc-dir pkg-desc) t))))

`native-comp-available-p' is provided by Compat. You can use it
directly. It aliases `ignore' on Emacs 27 and older.

>        ;; Insert news if available.
>        (when news
> -        (insert "\n" (make-separator-line) "\n"
> -                (propertize "* News" 'face 'package-help-section-name)
> +        (insert "\n" (make-separator-line) "\n")
> +        (when (fboundp 'make-separator-line)
> +          (insert (make-separator-line) "\n"))
> +        (insert (propertize "* News" 'face 'package-help-section-name)
>                  "\n\n")
>          (insert-file-contents news))

`make-separator-line' is provided by Compat.

Daniel