From c33d0fee946abe25411286533b8e58b13f07cf6a Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Thu, 28 Dec 2023 04:05:18 +0200 Subject: Add gnosis-select-by-tag --- gnosis.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gnosis.el b/gnosis.el index 589ed27..efa10ed 100644 --- a/gnosis.el +++ b/gnosis.el @@ -363,6 +363,12 @@ Compare 2 strings, ignoring case and whitespace." (cl-loop for tags in (emacsql gnosis-db [:select tags :from notes]) nconc tags into all-tags finally return (delete-dups all-tags))) + +(defun gnosis-select-by-tag (input-tags) + "Return note id for every note with INPUT-TAGS." + (cl-loop for (id tags) in (emacsql gnosis-db [:select [id tags] :from notes]) + when (cl-every (lambda (tag) (member tag tags)) input-tags) + collect id)) ;; Review ;;;;;;;;;; (defun gnosis-review--algorithm (id success) -- cgit v1.2.3