From e2c4c4925e5c75b145fdeb94b7ee816657f6eb63 Mon Sep 17 00:00:00 2001 From: colin Date: Sat, 25 Mar 2023 16:44:06 -0700 Subject: initial commit --- fussy.lisp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 fussy.lisp (limited to 'fussy.lisp') diff --git a/fussy.lisp b/fussy.lisp new file mode 100644 index 0000000..9173e0a --- /dev/null +++ b/fussy.lisp @@ -0,0 +1,32 @@ +;;;; fussy.lisp + +(in-package #:fussy) + +(defvar +default-emacs-package-archive+ + "https://melpa.org/packages/archive-contents") + +(defun emacs-reader-readtable () + (let ((*readtable* (copy-readtable nil))) + (labels ((bracket-reader (stream char) + (declare (ignorable char)) + (read-delimited-list #\] stream))) + (set-macro-character #\[ #'bracket-reader) + (set-macro-character #\] (get-macro-character #\) nil)) + *readtable*))) + + +(defun fetch-emacs-archive (&optional (archive +default-emacs-package-archive+)) + (multiple-value-bind (stream status) (dexador:get archive :want-stream t) + (when (= 200 status) + (let ((*readtable* (emacs-reader-readtable))) + (read stream))))) + +(defun package-name-mentions (str) + (lambda (package) + (when (consp package) + (let ((string-name + (symbol-name (first package)))) + (search str string-name :test #'char-equal))))) + +(defun find-themes (archive-contents) + (remove-if-not (package-name-mentions "-theme") archive-contents)) -- cgit v1.2.3