summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-08-11 23:05:31 +0300
committerThanos Apollo <[email protected]>2024-08-11 23:05:31 +0300
commit73329e0ebfda93ebe99471788c2a9f1d17ca954b (patch)
tree60f64d0adaeb97609501196d4181c8ddfecc85ea /gnosis.el
parent66007456f5fdb2f95a0bb91bd15ed5b6f7a45ea9 (diff)
New function: tags--append.
* Append tag to the list of tags of note ID. * Meant to be used to auto tag notes, such as for overdue and to edit notes during dashboard view.
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/gnosis.el b/gnosis.el
index 9cca610..e29f32d 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -2232,6 +2232,14 @@ Defaults to current date."
(let* ((date (or date (gnosis-algorithm-date)))
(reviewed-new (or (car (gnosis-select 'reviewed-new 'activity-log `(= date ',date) t)) 0)))
reviewed-new))
+;; TODO: Auto tag overdue tags
+(defun gnosis-tags--append (id tag)
+ "Append TAG to the list of tags of note ID."
+ (cl-assert (numberp id) nil "ID must be the note id number")
+ (cl-assert (stringp tag) nil "Tag must a string")
+ (let* ((current-tags (gnosis-get 'tags 'notes `(= id ,id)))
+ (new-tags (append current-tags (list tag))))
+ (gnosis-update 'notes `(= tags ',new-tags) `(= id ,id))))
(cl-defun gnosis-export-note (id &optional (export-for-deck nil))
"Export fields for note with value of id ID.