From feb8a4496b93b412c9f3d6197499127cdbc945fe Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Tue, 23 Jul 2024 17:01:03 +0300 Subject: New function: dashboard-generate-dates. * Generate all possible dates for YEAR. --- gnosis-dashboard.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gnosis-dashboard.el b/gnosis-dashboard.el index d1eb8fb..c2279c2 100644 --- a/gnosis-dashboard.el +++ b/gnosis-dashboard.el @@ -56,6 +56,17 @@ '((t :inherit (outline-1) :weight bold)) "Face for the dashboard header.." :group 'gnosis) + +(defun gnosis-dashboard-generate-dates (&optional year) + "Return a list of all dates (year month day) for YEAR." + (let* ((current-year (or (decoded-time-year (decode-time)) year)) + (result '())) + (dotimes (month 12) + (let ((days-in-month (calendar-last-day-of-month (+ month 1) current-year))) + (dotimes (day days-in-month) + (push (list current-year (+ month 1) (+ day 1)) result)))) + (nreverse result))) + (defun gnosis-dashboard-output-note (id) "Output contents for note with ID, formatted for gnosis dashboard." (cl-loop for item in (append (gnosis-select '[main options answer tags type] 'notes `(= id ,id) t) -- cgit v1.2.3