emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] elpa-admin 72333132a0 4/4: Support ignore value for :readme


From: Stefan Kangas
Subject: [elpa] elpa-admin 72333132a0 4/4: Support ignore value for :readme
Date: Thu, 6 Jan 2022 05:19:11 -0500 (EST)

branch: elpa-admin
commit 72333132a0680c840654241b108036d6a61ff92e
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    Support ignore value for :readme
    
    * elpa-admin.el (elpaa--get-README): Support ignore value for
    :readme.
    (elpaa--get-section): Check that given file is a
    regular file before reading it as one.
    * README: Document above change.
---
 README        |  5 +++--
 elpa-admin.el | 22 ++++++++++++----------
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/README b/README
index b99e4815cf..a0e34ff78c 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
 #+TITLE: ELPA-Admin README
-#+DATE: 2020-11-28
+#+DATE: 2022-01-06
 
 Copyright (C) 2010-2022 Free Software Foundation, Inc. \\
 See the end of the file for license conditions.
@@ -132,7 +132,8 @@ having to specify it here.
 ** =:readme FILE=
 Name of the file to use as the description of the package.  By default
 we try to use README, README.rst, README.org, or the Commentary section
-in the main file.
+in the main file.  If ~ignore~, ignore any matching file and use the Commentary
+section.
 
 ** =:news FILE=
 Name of the file that contains the list of changes in recent versions
diff --git a/elpa-admin.el b/elpa-admin.el
index 22d479fedd..568c05e89b 100644
--- a/elpa-admin.el
+++ b/elpa-admin.el
@@ -1283,7 +1283,8 @@ HEADER in package's main file."
               (cdr file))))
     (when (consp file) (setq file (car file))))
   (cond
-   ((file-readable-p (expand-file-name file srcdir))
+   ((let ((fil (expand-file-name file srcdir)))
+      (and (file-readable-p fil) (file-regular-p fil)))
     ;; Return FILE's contents.
     (let ((type (elpaa--extension-to-mime (file-name-extension file)))
           (content (with-temp-buffer
@@ -1349,15 +1350,16 @@ arbitrary code."
       (delete-file output-filename))))
 
 (defun elpaa--get-README (pkg-spec dir)
-  (or (elpaa--get-section
-       "Commentary" (elpaa--spec-get pkg-spec :readme
-                                     '("README" "README.rst"
-                                       ;; Most README.md files seem to be
-                                       ;; currently worse than the Commentary:
-                                       ;; section :-( "README.md"
-                                       "README.org"))
-       dir pkg-spec)
-      '(text/plain . "!No description!")))
+  (let ((readme (elpaa--spec-get pkg-spec :readme
+                                 '("README" "README.rst"
+                                   ;; Most README.md files seem to be
+                                   ;; currently worse than the Commentary:
+                                   ;; section :-( "README.md"
+                                   "README.org"))))
+    (or (elpaa--get-section
+         "Commentary" (unless (eq readme 'ignore) readme)
+         dir pkg-spec)
+        '(text/plain . "!No description!"))))
 
 (defun elpaa--get-NEWS (pkg-spec dir)
   (let* ((news



reply via email to

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