summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-08-06 23:53:45 +0300
committerThanos Apollo <[email protected]>2024-08-06 23:53:45 +0300
commit1c2b2c4e41005e126e81aa73018d00c8004133dc (patch)
treeb092a002a5eaaaa9898a3e5f4a09773412e75816
parent9ad5793b12a1195878113337c117461c929dcfb2 (diff)
New function: get-custom-tag-values
* Return custom tag values.
-rw-r--r--gnosis.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/gnosis.el b/gnosis.el
index c7d02a5..60b8ff2 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -1995,6 +1995,15 @@ VALUES: Defaults to `gnosis-custom-values'."
"Return custom VALUE for note DECK."
(plist-get (gnosis-get-custom-values :deck deck values) value))
+(defun gnosis-get-custom-tag-values (id keyword &optional custom-tags custom-values)
+ "Return KEYWORD values for note ID."
+ (cl-assert (keywordp keyword) nil "keyword must be a keyword!")
+ (let ((tags (if id (gnosis-get 'tags 'notes `(= id ,id)) custom-tags)))
+ (cl-loop for tag in tags
+ ;; Only collect non-nil values
+ when (plist-get (gnosis-get-custom-values :tag tag custom-values) keyword)
+ collect (plist-get (gnosis-get-custom-values :tag tag custom-values) keyword))))
+
(defun gnosis-get-date-total-notes (&optional date)
"Return total notes reviewed for DATE.