From b2e73ea9e87c072ca39831f4600f4579f5953022 Mon Sep 17 00:00:00 2001 From: colin Date: Sun, 24 Mar 2024 15:23:13 -0700 Subject: Add: complement term filters in theme search --- fussy.lisp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'fussy.lisp') diff --git a/fussy.lisp b/fussy.lisp index 08a7eab..b367f71 100644 --- a/fussy.lisp +++ b/fussy.lisp @@ -220,15 +220,20 @@ returns a list of those names." (defvar *theme-matcher-cache* (make-hash-table :test #'equal)) +(defun theme-term-matcher (term) + (if (eq #\- (elt term 0)) + (complement (theme-term-matcher (string-left-trim "-" term))) + (lambda (theme) + (or (search term theme) + (with-slots + (name keywords description authors maintainer) (theme-package theme) + (or (search term (symbol-name name) :test #'char-equal) + (search term description :test #'char-equal))))))) + (defun theme-mentions-anywhere (term) (or (gethash (string-downcase term) *theme-matcher-cache*) (setf (gethash (string-downcase term) *theme-matcher-cache*) - (lambda (theme) - (or (search term theme) - (with-slots - (name keywords description authors maintainer) (theme-package theme) - (or (search term (symbol-name name) :test #'char-equal) - (search term description :test #'char-equal)))))))) + (theme-term-matcher term)))) -- cgit v1.2.3