[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] elpa-admin 73db0c8: * elpa-admin.el (elpaa--get-section): Return
From: |
Stefan Monnier |
Subject: |
[elpa] elpa-admin 73db0c8: * elpa-admin.el (elpaa--get-section): Return nil when appropriate |
Date: |
Sun, 10 Oct 2021 12:21:07 -0400 (EDT) |
branch: elpa-admin
commit 73db0c8d94ad7bc027f05825e13f4f7a7e14be77
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
* elpa-admin.el (elpaa--get-section): Return nil when appropriate
(elpaa--html-make-pkg): Handle nil return value.
---
elpa-admin.el | 56 ++++++++++++++++++++++++++++----------------------------
1 file changed, 28 insertions(+), 28 deletions(-)
diff --git a/elpa-admin.el b/elpa-admin.el
index b9c1b87..61918b6 100644
--- a/elpa-admin.el
+++ b/elpa-admin.el
@@ -1263,32 +1263,31 @@ HEADER in package's main file."
(cons type content)))
((file-readable-p (expand-file-name (elpaa--main-file pkg-spec) srcdir))
;; Return specified section from package's main source file.
- (let ((type 'text/plain)
- (content (with-temp-buffer
- (insert-file-contents
- (expand-file-name (elpaa--main-file pkg-spec) srcdir))
- (emacs-lisp-mode) ;lm-section-start needs the
outline-mode setting.
- (let ((start (lm-section-start header)))
- (when start
- ;; FIXME: Emacs<28 had a bug in `lm-section-end', so
cook up
- ;; our own ad-hoc replacement.
- (goto-char start) (forward-line 1)
- (re-search-forward "^\\(;;;[^;\n]\\|[^; \n]\\)" nil t)
- (insert
- (prog1
- (buffer-substring start (match-beginning 0))
- (erase-buffer)))
- (emacs-lisp-mode)
- (goto-char (point-min))
- (delete-region (point) (line-beginning-position 2))
- (uncomment-region (point-min) (point-max))
- (when (looking-at "^\\([ \t]*\n\\)+")
- (replace-match ""))
- (goto-char (point-max))
- (skip-chars-backward " \t\n")
- (delete-region (point) (point-max))
- (buffer-string))))))
- (cons type content)))))
+ (with-temp-buffer
+ (let ((type 'text/plain))
+ (insert-file-contents
+ (expand-file-name (elpaa--main-file pkg-spec) srcdir))
+ (emacs-lisp-mode) ;lm-section-start needs the outline-mode
setting.
+ (let ((start (lm-section-start header)))
+ (when start
+ ;; FIXME: Emacs<28 had a bug in `lm-section-end', so cook up
+ ;; our own ad-hoc replacement.
+ (goto-char start) (forward-line 1)
+ (re-search-forward "^\\(;;;[^;\n]\\|[^; \n]\\)" nil t)
+ (insert
+ (prog1
+ (buffer-substring start (match-beginning 0))
+ (erase-buffer)))
+ (emacs-lisp-mode)
+ (goto-char (point-min))
+ (delete-region (point) (line-beginning-position 2))
+ (uncomment-region (point-min) (point-max))
+ (when (looking-at "^\\([ \t]*\n\\)+")
+ (replace-match ""))
+ (goto-char (point-max))
+ (skip-chars-backward " \t\n")
+ (delete-region (point) (point-max))
+ (cons type (buffer-string)))))))))
(cl-defun elpaa--export-org (content backend &key body-only ext-plist)
"Return Org CONTENT as an exported string.
@@ -1428,8 +1427,9 @@ arbitrary code."
;; "README.md"
"README.org")))
(readme-content
- (elpaa--get-section "Commentary" package-readme-file-name
- srcdir pkg-spec))
+ (or (elpaa--get-section "Commentary" package-readme-file-name
+ srcdir pkg-spec)
+ '(text/plain . "!No description!")))
(readme-text (elpaa--section-to-plain-text readme-content))
(readme-html (elpaa--section-to-html readme-content))
(readme-output-filename (concat name "-readme.txt")))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] elpa-admin 73db0c8: * elpa-admin.el (elpaa--get-section): Return nil when appropriate,
Stefan Monnier <=