summaryrefslogtreecommitdiff
path: root/org-fc-core.el
diff options
context:
space:
mode:
authorLeon Rische <leon.rische@me.com>2022-11-30 12:45:24 +0100
committerLeon Rische <leon.rische@me.com>2022-11-30 12:45:24 +0100
commit44876305b38e11ac253817549a4271f926721c1e (patch)
tree62bf718d0cb1b65b04db56643d3cccdaeed82058 /org-fc-core.el
parent973a16a9561f1ed2fd7e4c5c614b5e5d15715b12 (diff)
Change indexing functions to group cards by files
Diffstat (limited to 'org-fc-core.el')
-rw-r--r--org-fc-core.el15
1 files changed, 14 insertions, 1 deletions
diff --git a/org-fc-core.el b/org-fc-core.el
index db4ff86..5ff8be1 100644
--- a/org-fc-core.el
+++ b/org-fc-core.el
@@ -581,7 +581,20 @@ use `(and (type double) (tag \"math\"))'."
(if filter (setq filter (org-fc--compile-filter filter)))
- (funcall org-fc-index-function paths filter)))
+ (org-fc-index-flatten-file
+ (funcall org-fc-index-function paths filter))))
+
+(defun org-fc-index-flatten-file (index)
+ "Flatten INDEX into a list of cards.
+Relevant data from the file is included in each card element."
+ (mapcan
+ (lambda (file)
+ (mapcar
+ (lambda (card)
+ (plist-put card :path (plist-get file :path))
+ (plist-put card :filetitle (plist-get file :title)))
+ (plist-get file :cards)))
+ index))
(defun org-fc-index-flatten-card (card)
"Flatten CARD into a list of positions.