diff options
author | Sacha Chua <sacha@sachachua.com> | 2024-12-27 10:16:51 -0500 |
---|---|---|
committer | Sacha Chua <sacha@sachachua.com> | 2024-12-27 10:16:51 -0500 |
commit | 574e83bd218859d10f1f421ed85d37449dfc18b7 (patch) | |
tree | 4c09424aa16926c01cd625c0a04a305351fe763b | |
parent | 0c9155ccee010dd2df3f6e6816c7325abfccee29 (diff) | |
download | emacsconf-el-574e83bd218859d10f1f421ed85d37449dfc18b7.tar.xz emacsconf-el-574e83bd218859d10f1f421ed85d37449dfc18b7.zip |
add emacsconf-stream-populate-random-package-file
Diffstat (limited to '')
-rw-r--r-- | emacsconf-stream.el | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/emacsconf-stream.el b/emacsconf-stream.el index 55c4648..6641392 100644 --- a/emacsconf-stream.el +++ b/emacsconf-stream.el @@ -1280,5 +1280,35 @@ International (CC BY-SA 4.0) license. Please observe the guidelines for conduct: (kill-new desc)) desc)) +(defun emacsconf-stream-populate-random-package-file () + (interactive) + (with-temp-file (expand-file-name "fortune.txt" emacsconf-cache-dir) + (dolist (entry + (emacsconf-stream-shuffle-list + (seq-mapcat (lambda (f) + (let ((base (file-name-base f))) + (mapcar + (lambda (entry) + (list base + (symbol-name (car entry)) + (elt (cdr entry) 2))) + (cdr + (with-temp-buffer + (insert-file-contents + (expand-file-name "archive-contents" f)) + (goto-char (point-min)) + (read (current-buffer))))))) + (directory-files + (expand-file-name "archives" package-user-dir) t + directory-files-no-dot-files-regexp)))) + (unless (bobp) (insert "\n%\n")) + (insert + (format "%s: %s (%s)" + (elt entry 1) + (elt entry 2) + (pcase (elt entry 0) + ("gnu" "GNU ELPA") + ("nongnu" "NonGNU ELPA") + ("melpa" "MELPA"))))))) (provide 'emacsconf-stream) ;;; emacsconf-stream.el ends here |