summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-04-02 19:13:16 +0300
committerThanos Apollo <[email protected]>2024-04-02 19:13:16 +0300
commit248ae9a69e1aa476546b152f22f4bef035403207 (patch)
treed505451afb16844cd06cc2489f3fea999c87c35a /gnosis.el
parentfcc09a3efc652cdf58208487531243f911e64fd2 (diff)
Add gnosis-collect-note-ids
A command to simplify collecting note-ids
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el25
1 files changed, 25 insertions, 0 deletions
diff --git a/gnosis.el b/gnosis.el
index bbc1acc..303cfad 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -1613,6 +1613,31 @@ to improve readability."
;; (gnosis-dashboard-output-notes)
;; (revert-buffer t t t)))
(local-set-key (kbd "a") #'gnosis-add-note)))
+(cl-defun gnosis-collect-note-ids (&key (tags nil) (due nil) (deck nil))
+ "Return list of note ids based on TAGS, DUE, DECKS.
+
+TAGS: boolean value, t to specify tags.
+DUE: boolean value, t to specify due notes.
+DECK: boolean value, t to specify notes from deck."
+ (cl-assert (and (booleanp due) (booleanp tags) (booleanp deck)) nil "provide boolean value")
+ (cond ((and (null tags) (null due) (null deck))
+ (gnosis-select 'id 'notes '1=1 t))
+ ;; All due notes
+ ((and (null tags) due (null deck))
+ (gnosis-review-get-due-notes))
+ ;; All notes for tags
+ ((and tags (null due) (null deck))
+ (gnosis-select-by-tag (gnosis-tag-prompt)))
+ ;; All due notes for tags
+ ((and tags due (null deck))
+ (gnosis-select-by-tag (gnosis-tag-prompt :due t)))
+ ;; All notes for deck
+ ((and (null tags) (null due) deck)
+ (gnosis-get-deck-notes nil nil))
+ ;; All due notes for deck
+ ((and (null tags) due deck)
+ (gnosis-get-deck-notes nil t))))
+
(defun gnosis-dashboard-deck-note-count (id)
"Return total note count for deck with ID."