unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Cc: 36301@debbugs.gnu.org
Subject: bug#36301: Package-Requires should support multiple lines
Date: Tue, 20 Aug 2019 09:29:07 -0400	[thread overview]
Message-ID: <85v9usj78c.fsf@gmail.com> (raw)
In-Reply-To: <m3ftm0eqix.fsf@fitzsim.org> (Thomas Fitzsimmons's message of "Fri, 16 Aug 2019 17:42:14 -0400")

Thomas Fitzsimmons <fitzsim@fitzsim.org> writes:
> I wonder if there's a better way to do the equivalent of mapconcat but
> produce nil on a nil input sequence.

Not exactly, but I think this is good place for and-let*:

--- i/lisp/emacs-lisp/package.el
+++ w/lisp/emacs-lisp/package.el
@@ -1028,6 +1028,7 @@ package--prepare-dependencies
               deps))))
 
 (declare-function lm-header "lisp-mnt" (header))
+(declare-function lm-header-multiline "lisp-mnt" (header))
 (declare-function lm-homepage "lisp-mnt" (&optional file))
 (declare-function lm-keywords-list "lisp-mnt" (&optional file))
 (declare-function lm-maintainer "lisp-mnt" (&optional file))
@@ -1054,8 +1055,7 @@ package-buffer-info
     (narrow-to-region start (point))
     (require 'lisp-mnt)
     ;; Use some headers we've invented to drive the process.
-    (let* ((requires-str (lm-header "package-requires"))
-           ;; Prefer Package-Version; if defined, the package author
+    (let* (;; Prefer Package-Version; if defined, the package author
            ;; probably wants us to use it.  Otherwise try Version.
            (pkg-version
             (or (package-strip-rcs-id (lm-header "package-version"))
@@ -1067,9 +1067,9 @@ package-buffer-info
             "Package lacks a \"Version\" or \"Package-Version\" header"))
       (package-desc-from-define
        file-name pkg-version desc
-       (if requires-str
-           (package--prepare-dependencies
-            (package-read-from-string requires-str)))
+       (and-let* ((require-lines (lm-header-multiline "package-requires")))
+         (package--prepare-dependencies
+          (package-read-from-string (mapconcat #'identity require-lines " "))))
        :kind 'single
        :url homepage
        :keywords keywords






  reply	other threads:[~2019-08-20 13:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-20  1:55 bug#36301: Package-Requires should support multiple lines Thomas Fitzsimmons
2019-06-20 11:36 ` Noam Postavsky
2019-08-16  4:03   ` Thomas Fitzsimmons
2019-08-16 16:03     ` Glenn Morris
2019-08-16 16:22       ` Thomas Fitzsimmons
2019-08-16 21:42         ` Thomas Fitzsimmons
2019-08-20 13:29           ` Noam Postavsky [this message]
2019-09-01  1:40             ` Thomas Fitzsimmons
2019-09-01 17:34               ` Thomas Fitzsimmons

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=85v9usj78c.fsf@gmail.com \
    --to=npostavs@gmail.com \
    --cc=36301@debbugs.gnu.org \
    --cc=fitzsim@fitzsim.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).