[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] elpa-admin d4c962a: * elpa-admin.el (elpaa--get-section): Add doc
From: |
Stefan Monnier |
Subject: |
[elpa] elpa-admin d4c962a: * elpa-admin.el (elpaa--get-section): Add docstring, rename vars |
Date: |
Sun, 29 Aug 2021 20:46:33 -0400 (EDT) |
branch: elpa-admin
commit d4c962aaed9d483006aa14b01606c77e66a147d4
Author: Adam Porter <adam@alphapapa.net>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
* elpa-admin.el (elpaa--get-section): Add docstring, rename vars
---
elpa-admin.el | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/elpa-admin.el b/elpa-admin.el
index 4c84360..ac72f2f 100644
--- a/elpa-admin.el
+++ b/elpa-admin.el
@@ -1167,25 +1167,28 @@ Rename DIR/ to PKG-VERS/, and return the descriptor."
(insert-file-contents mainsrcfile)
(lm-header prop))))))
-(defun elpaa--get-section (hsection fsection srcdir pkg-spec)
- (when (consp fsection)
- (while (cdr-safe fsection)
- (setq fsection
- (if (file-readable-p (expand-file-name (car fsection) srcdir))
- (car fsection)
- (cdr fsection))))
- (when (consp fsection) (setq fsection (car fsection))))
+(defun elpaa--get-section (header file srcdir pkg-spec)
+ "Return specified section as a string from SRCDIR for PKG-SPEC.
+If FILE is readable in SRCDIR, return its contents. Otherwise
+return section under HEADER in package's main file."
+ (when (consp file)
+ (while (cdr-safe file)
+ (setq file
+ (if (file-readable-p (expand-file-name (car file) srcdir))
+ (car file)
+ (cdr file))))
+ (when (consp file) (setq file (car file))))
(cond
- ((file-readable-p (expand-file-name fsection srcdir))
+ ((file-readable-p (expand-file-name file srcdir))
(with-temp-buffer
- (insert-file-contents (expand-file-name fsection srcdir))
+ (insert-file-contents (expand-file-name file srcdir))
(buffer-string)))
((file-readable-p (expand-file-name (elpaa--main-file pkg-spec) srcdir))
(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 hsection)))
+ (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.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] elpa-admin d4c962a: * elpa-admin.el (elpaa--get-section): Add docstring, rename vars,
Stefan Monnier <=