From 73329e0ebfda93ebe99471788c2a9f1d17ca954b Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Sun, 11 Aug 2024 23:05:31 +0300 Subject: 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. --- gnosis.el | 8 ++++++++ 1 file changed, 8 insertions(+) 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. -- cgit v1.2.3