summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-12-28 04:05:18 +0200
committerThanos Apollo <[email protected]>2023-12-28 04:05:18 +0200
commitc33d0fee946abe25411286533b8e58b13f07cf6a (patch)
treee56d8e88a5deb8b1768910e49e935eb6d0a32373 /gnosis.el
parent8d0034663c7e6d9ad079cc1910dedb36eb802281 (diff)
Add gnosis-select-by-tag
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el6
1 files changed, 6 insertions, 0 deletions
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)