emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Request to add Package to GNU ELPA


From: Philip Kaludercic
Subject: Re: Request to add Package to GNU ELPA
Date: Fri, 07 Apr 2023 10:07:58 +0000

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Why not just replace (make-separator-line) with
> (if (fboundp 'make-separator-line) (make-separator-line) "")?
> `newline` is a command and I think it's preferable not to use it
> from ELisp.

Turns out that Compat supports this, so we don't need the check.

Here is the revised patch:

>From e778cff125cf48f933256c488adbcd362a31f715 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@posteo.net>
Date: Wed, 5 Apr 2023 23:16:39 +0200
Subject: [PATCH] Prepare package.el to be published on GNU ELPA

* lisp/emacs-lisp/package.el: Add Compat as a dependency.
(package--native-compile-async): Check if 'native-comp-available-p' is
bound.
(lm-homepage, lm-website): Use backwards-compatible alias
'lm-homepage'.
(package-buffer-info): Call 'lm-maintainer' if 'lm-maintainers' is not
defined.
(describe-package-1): Avoid using 'make-separator-line' if not bound.
(package-report-bug): Expand 'custom--standard-value' definition.

For the background and motivation behind these changes, please consult
this thread:
https://lists.gnu.org/archive/html/emacs-devel/2023-03/msg00995.html.
---
 lisp/emacs-lisp/package.el | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 0258ed52bee..8f5da5af1ea 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -5,9 +5,12 @@
 ;; Author: Tom Tromey <tromey@redhat.com>
 ;;         Daniel Hackney <dan@haxney.org>
 ;; Created: 10 Mar 2007
-;; Version: 1.1.0
+;; Version: 1.1.1
 ;; Keywords: tools
-;; Package-Requires: ((tabulated-list "1.0"))
+;; Package-Requires: ((emacs "27.1") (compat "29.1.0.0"))
+
+;; 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 'tabulated-list)
@@ -1124,7 +1128,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))))
 
@@ -1160,9 +1165,10 @@ package--prepare-dependencies
 
 (declare-function lm-header "lisp-mnt" (header))
 (declare-function lm-header-multiline "lisp-mnt" (header))
-(declare-function lm-website "lisp-mnt" (&optional file))
+(declare-function lm-homepage "lisp-mnt" (&optional file))
 (declare-function lm-keywords-list "lisp-mnt" (&optional file))
 (declare-function lm-maintainers "lisp-mnt" (&optional file))
+(declare-function lm-maintainer "lisp-mnt" (&optional file))
 (declare-function lm-authors "lisp-mnt" (&optional file))
 
 (defun package-buffer-info ()
@@ -1195,7 +1201,7 @@ package-buffer-info
             (or (lm-header "package-version") (lm-header "version")))
            (pkg-version (package-strip-rcs-id version-info))
            (keywords (lm-keywords-list))
-           (website (lm-website)))
+           (website (lm-homepage)))
       (unless pkg-version
          (if version-info
              (error "Unrecognized package version: %s" version-info)
@@ -1211,7 +1217,10 @@ package-buffer-info
        :maintainer
        ;; For backward compatibility, use a single string if there's only
        ;; one maintainer (the most common case).
-       (let ((maints (lm-maintainers))) (if (cdr maints) maints (car maints)))
+       (if (fboundp 'lm-maintainers)
+           (let ((maints (lm-maintainers)))
+             (if (cdr maints) maints (car maints)))
+         (lm-maintainer))
        :authors (lm-authors)))))
 
 (defun package--read-pkg-desc (kind)
@@ -2302,8 +2311,6 @@ package-strip-rcs-id
       ;; to make sure we use a "canonical name"!
       (if l (package-version-join l)))))
 
-(declare-function lm-website "lisp-mnt" (&optional file))
-
 ;;;###autoload
 (defun package-install-from-buffer ()
   "Install a package from the current buffer.
@@ -4571,7 +4578,9 @@ package-report-bug
       (dolist (ent (get (cdr group) 'custom-group))
         (when (and (custom-variable-p (car ent))
                    (boundp (car ent))
-                   (not (eq (custom--standard-value (car ent))
+                   (not (eq (if (fboundp 'custom--standard-value)
+                                (custom--standard-value (car ent))
+                              (eval (car (get (car ent) 'standard-value)) t))
                             (default-toplevel-value (car ent))))
                    (file-in-directory-p (car group) (package-desc-dir desc)))
           (push (car ent) vars))))
-- 
2.30.2

And here is the compile-log I got after installing the package on Emacs
27.1:

--8<---------------cut here---------------start------------->8---
Compiling file /home/philip/.config/emacs/elpa/package-1.1.1/package.el at Fri 
Apr  7 11:58:06 2023
Entering directory ‘/home/philip/.config/emacs/elpa/package-1.1.1/’

In package-tar-file-info:
package.el:1243:8:Warning: ‘(filename (tar-header-name (car tar-parse-info)))’
    is a malformed function
package.el:1247:31:Warning: reference to free variable ‘loop’
package.el:1249:58:Warning: reference to free variable ‘filename’

In package-menu-toggle-hiding:
package.el:3208:4:Warning: malformed interactive spec: (interactive nil
    package-menu-mode)

In package-menu-hide-package:
package.el:3556:4:Warning: malformed interactive spec: (interactive nil
    package-menu-mode)

In package-menu-describe-package:
package.el:3580:4:Warning: malformed interactive spec: (interactive nil
    package-menu-mode)

In package-menu-mark-delete:
package.el:3590:4:Warning: malformed interactive spec: (interactive "p"
    package-menu-mode)

In package-menu-mark-install:
package.el:3599:4:Warning: malformed interactive spec: (interactive "p"
    package-menu-mode)

In package-menu-mark-unmark:
package.el:3607:4:Warning: malformed interactive spec: (interactive "p"
    package-menu-mode)

In package-menu-backup-unmark:
package.el:3613:4:Warning: malformed interactive spec: (interactive nil
    package-menu-mode)

In package-menu-mark-obsolete-for-deletion:
package.el:3620:4:Warning: malformed interactive spec: (interactive nil
    package-menu-mode)

In package-menu-quick-help:
package.el:3652:4:Warning: malformed interactive spec: (interactive nil
    package-menu-mode)

In package-menu-mark-upgrades:
package.el:3745:4:Warning: malformed interactive spec: (interactive nil
    package-menu-mode)

In package-menu-execute:
package.el:3870:4:Warning: malformed interactive spec: (interactive nil
    package-menu-mode)

In package-menu-filter-by-archive:
package.el:4127:4:Warning: malformed interactive spec: (interactive (list
    (completing-read-multiple "Filter by archive (comma separated): " (mapcar
    #'car package-archives))) package-menu-mode)

In package-menu-filter-by-description:
package.el:4149:4:Warning: malformed interactive spec: (interactive (list
    (read-regexp "Filter by description (regexp)")) package-menu-mode)

In package-menu-filter-by-keyword:
package.el:4169:4:Warning: malformed interactive spec: (interactive (list
    (completing-read-multiple "Keywords (comma separated): "
    (package-all-keywords))) package-menu-mode)

In package-menu-filter-by-name-or-description:
package.el:4194:4:Warning: malformed interactive spec: (interactive (list
    (read-regexp "Filter by name or description (regexp)")) package-menu-mode)

In package-menu-filter-by-name:
package.el:4214:4:Warning: malformed interactive spec: (interactive (list
    (read-regexp "Filter by name (regexp)")) package-menu-mode)

In package-menu-filter-by-status:
package.el:4234:4:Warning: malformed interactive spec: (interactive (list
    (completing-read "Filter by status: " '("avail-obso" "available"
    "built-in" "dependency" "disabled" "external" "held" "incompat"
    "installed" "source" "new" "unsigned"))) package-menu-mode)

In package-menu-filter-by-version:
package.el:4273:4:Warning: malformed interactive spec: (interactive (let
    ((choice (intern (char-to-string (read-char-choice "Filter by version?
    [Type =, <, > or q] " '(60 62 61 113)))))) (if (eq choice 'q) '(quit nil)
    (list (read-from-minibuffer (concat "Filter by version (" (cond ((eq
    choice '=) "= equal to") ((eq choice '<) "< less than") ((eq choice '>) ">
    greater than") (t nil)) "): ")) choice))) package-menu-mode)

In package-menu-filter-marked:
package.el:4307:4:Warning: malformed interactive spec: (interactive nil
    package-menu-mode)

In package-menu-filter-upgradable:
package.el:4335:4:Warning: malformed interactive spec: (interactive nil
    package-menu-mode)

In package-menu-clear-filter:
package.el:4344:4:Warning: malformed interactive spec: (interactive nil
    package-menu-mode)

In package-browse-url:
package.el:4528:4:Warning: malformed interactive spec: (interactive (list
    (package--query-desc) current-prefix-arg) package-menu-mode)

In package-report-bug:
package.el:4571:4:Warning: malformed interactive spec: (interactive (list
    (package--query-desc package-alist)) package-menu-mode)
package.el:4571:43:Warning: ‘(reporter-prompt-for-summary-p t)’ is a malformed
    function

In end of data:
package.el:4602:1:Warning: the following functions are not known to be defined:
    file-name-concat, length>, loaddefs-generate,
    native-compile-async, named-let, loop, length=,
    comp-clean-up-stale-eln, format-prompt, substitute-quotes,
    make-separator-line, defvar-keymap, ensure-list,
    macroexp-file-name, dlet
--8<---------------cut here---------------end--------------->8---

The most common issue is that the interactive spec has to be revised to
use only one argument.  IIUC this can be replaced by a `declare' form
with a `modes' entry?

This also gives us a better picture of the unknown functions:

- loaddefs-generate (not provided by Compat)
- substitute-quotes (provided by Compat)
- defvar-keymap (provided by Compat)

I will take a look at what is necessary to back-port `loaddefs-generate'
via Compat.

-- 
Philip Kaludercic

reply via email to

[Prev in Thread] Current Thread [Next in Thread]