summaryrefslogtreecommitdiff
path: root/org-fc-awk.el
diff options
context:
space:
mode:
authorLeon Rische <leon.rische@me.com>2020-11-12 10:58:36 +0100
committerLeon Rische <leon.rische@me.com>2020-11-12 10:58:36 +0100
commit9f0f553ff03629637df55555fea51963a8d046e0 (patch)
treed3af16ba9c3a8ca88d17e34b56f4baa73a97cdeb /org-fc-awk.el
parente25aea83e8dd0031ffb1c8ddfe3a02d45334aeec (diff)
Add caching indexer prototype
Diffstat (limited to 'org-fc-awk.el')
-rw-r--r--org-fc-awk.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/org-fc-awk.el b/org-fc-awk.el
index b0dbe11..0a3d151 100644
--- a/org-fc-awk.el
+++ b/org-fc-awk.el
@@ -91,6 +91,15 @@ ITAGS and LTAGS are strings `\":tag1:tag2:\"'"
(plist-get file :cards)))
index))
+(defun org-fc-awk-index (paths &optional filter)
+ "Find cards in PATHS matching an optional FILTER predicate.
+FILTER can be either nil or a function taking a single card as
+ its input."
+ (let ((index (org-fc-awk-index-paths paths)))
+ (if filter
+ (cl-remove-if-not filter index)
+ index)))
+
(defun org-fc-awk-index-paths (paths)
"Generate a list of all cards and positions in PATHS."
(let ((output (shell-command-to-string