summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fussy.lisp24
1 files changed, 19 insertions, 5 deletions
diff --git a/fussy.lisp b/fussy.lisp
index def6d46..10c5612 100644
--- a/fussy.lisp
+++ b/fussy.lisp
@@ -135,7 +135,9 @@ differs from the theme-pkg instance already in the data store."
;; if we didn't error: update the db
(dolist (archive-theme themes-to-update)
- (process-archive-theme archive-theme)))))
+ (process-archive-theme archive-theme))
+
+ (reindex-themes-by-package))))
(defun all-theme-keywords ()
(delete-duplicates
@@ -174,9 +176,8 @@ returns a list of those names."
(defun theme-mentions-anywhere (term)
(lambda (theme)
- (if (stringp theme)
- (search term theme)
- (with-slots (name keywords description authors maintainer) theme
+ (or (search term theme)
+ (with-slots (name keywords description authors maintainer) (theme-package theme)
(or (search term (symbol-name name) :test #'char-equal)
(some (lambda (keyword) (search term keyword :test #'char-equal)) keywords)
(search term description :test #'char-equal))))))
@@ -184,7 +185,20 @@ returns a list of those names."
(defun search-themes (&rest terms)
(remove-if-not
(apply #'a:conjoin (mapcar #'theme-mentions-anywhere terms))
- (all-theme-packages)))
+ (all-themes)))
+
+(defvar *theme->packages* nil
+ "A hash table indexing packages by the themes they contain.")
+
+(defun theme-package (theme) (gethash theme *theme->packages*))
+
+(defun reindex-themes-by-package ()
+ (let ((table (make-hash-table :test #'equal)))
+ (dolist (pkg (all-theme-packages))
+ (dolist (theme (themes-in-package pkg))
+ (setf (gethash theme table) pkg)))
+ (setf *theme->packages* table)))
+
(defclass/std config ()
((theme-image-directory