;;;; 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))