[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa-admin 8ee4770 264/439: [admin int] Add abstraction: archiv
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa-admin 8ee4770 264/439: [admin int] Add abstraction: archive--form-from-file-contents |
Date: |
Sun, 17 Oct 2021 15:48:16 -0400 (EDT) |
branch: elpa-admin
commit 8ee477062712545321a2810c964e45f9756a8e4a
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>
[admin int] Add abstraction: archive--form-from-file-contents
* admin/archive-contents.el (archive--form-from-file-contents): New func.
(archive--multi-file-package-def, archive--get-prop)
(archive--read-externals-list, archive--html-make-index): Use it.
---
admin/archive-contents.el | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/admin/archive-contents.el b/admin/archive-contents.el
index 67f4414..6f2fc76 100755
--- a/admin/archive-contents.el
+++ b/admin/archive-contents.el
@@ -299,15 +299,21 @@ Rename DIR/ to PKG-VERS/, and return the descriptor."
(cons (intern pkg) (vector (archive--version-to-list vers)
req (nth 3 exp) 'tar extras))))
+(defun archive--form-from-file-contents (filename)
+ (with-temp-buffer
+ (insert-file-contents filename)
+ ;; This is unnecessary because ‘with-temp-buffer’ generates a new
+ ;; (empty) buffer, and ‘insert-file-contents’ inserts after point.
+ ;; In other words, point is alraedy at bob.
+ ;;- (goto-char (point-min))
+ (read (current-buffer))))
+
(defun archive--multi-file-package-def (dir pkg)
"Return the `define-package' form in the file DIR/PKG-pkg.el."
(let ((pkg-file (expand-file-name (concat pkg "-pkg.el") dir)))
- (with-temp-buffer
- (unless (file-exists-p pkg-file)
- (error "File not found: %s" pkg-file))
- (insert-file-contents pkg-file)
- (goto-char (point-min))
- (read (current-buffer)))))
+ (unless (file-exists-p pkg-file)
+ (error "File not found: %s" pkg-file))
+ (archive--form-from-file-contents pkg-file)))
(defun archive--refresh-pkg-file ()
(let* ((dir (directory-file-name default-directory))
@@ -389,10 +395,8 @@ Rename DIR/ to PKG-VERS/, and return the descriptor."
(let ((pkgdescfile (expand-file-name (format "%s-pkg.el" name)
srcdir)))
(when (file-readable-p pkgdescfile)
- (with-temp-buffer
- (insert-file-contents pkgdescfile)
- (let ((desc (read (current-buffer))))
- (plist-get (cdr desc) kprop)))))
+ (let ((desc (archive--form-from-file-contents pkgdescfile)))
+ (plist-get (cdr desc) kprop))))
(when (file-readable-p mainsrcfile)
(with-temp-buffer
(insert-file-contents mainsrcfile)
@@ -437,9 +441,8 @@ Rename DIR/ to PKG-VERS/, and return the descriptor."
(replace-regexp-in-string "&" "&" txt)))
(defun archive--read-externals-list (&optional dir)
- (with-temp-buffer
- (insert-file-contents (expand-file-name "externals-list" dir))
- (read (current-buffer))))
+ (archive--form-from-file-contents
+ (expand-file-name "externals-list" dir)))
(defun archive--insert-repolinks (name srcdir _mainsrcfile url)
(when url
@@ -559,11 +562,8 @@ Rename DIR/ to PKG-VERS/, and return the descriptor."
(defun batch-html-make-index ()
(let ((packages (make-hash-table :test #'equal))
(archive-contents
- (with-temp-buffer
- (insert-file-contents "archive-contents")
- (goto-char (point-min))
- ;; Skip the first element which is a version number.
- (cdr (read (current-buffer))))))
+ ;; Skip the first element which is a version number.
+ (cdr (archive--form-from-file-contents "archive-contents"))))
(dolist (subdir (directory-files "../../build/packages" nil))
(cond
((member subdir '("." ".." "elpa.rss" "index.html" "archive-contents")))
- [nongnu] elpa-admin da7456c 065/439: write README in markdown, (continued)
- [nongnu] elpa-admin da7456c 065/439: write README in markdown, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 7ce78d5 071/439: Note that 'autogen.sh' should be run to generate 'configure' and 'Makefile.in' (see #11), Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin a745b29 076/439: * admin/archive-contents.el: Create web pages., Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 1daf0bb 085/439: Merge branch 'master' of github.com:rocky/emacs-loc-changes, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin e71d997 087/439: Merge remote-tracking branch 'repo.or.cz/elpa', Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin cd01c51 080/439: Remove the angle brackets, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 30c8a11 248/439: Merge commit '5f47b1f64cad8a06e945e2a1287b986a3676554d', Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 299da86 255/439: Package pages improvements, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 5067b05 258/439: Change to package directory before checking .elpaignore exclusions., Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin ec13cc2 260/439: Let ert-support.el work for subdirectories, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 8ee4770 264/439: [admin int] Add abstraction: archive--form-from-file-contents,
Philip Kaludercic <=
- [nongnu] elpa-admin ae66216 267/439: [admin int] Replace one-armed-‘if’ w/ either ‘when’ or ‘and’., Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin a23a8b8 271/439: Merge branch 'scratch/hook-helpers', Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 334aa51 273/439: Merge commit 'a1130df3ada34e76675324a8c25823b420b20239', Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin cb72492 279/439: Merge branch 'ebdb-bits', Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin c60a3bb 280/439: Merge branch 'scratch/which-key', Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 8154769 282/439: * copyright_exceptions: Update for new uni-confusables/gen-confusables.el, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 280353e 287/439: Merge commit 'cb905bdc728fb3b5f9fdff8836d71b62bd717eab' from mmm-mode, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin aa346f0 290/439: * GNUmakefile (org-fetch): Use https and stick to wget, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 84f67ae 294/439: * admin/archive-contents.el (archive--insert-repolinks): Fix last change, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 0c23652 046/439: Revert "Add an explicit OPERATION-MODE "nil" in README's examples", Philip Kaludercic, 2021/10/17