summaryrefslogtreecommitdiff
path: root/fussy.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'fussy.lisp')
-rw-r--r--fussy.lisp32
1 files changed, 32 insertions, 0 deletions
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))