Hi! Wondering if someone already figured out how to customize org-roam-dailies-find-today
etal to use a different org-roam-dailies-capture-templates
template depending on the day of the week \ day of the month \ …?
Defining multiple org-roa-dailies-capture-templates
doesn’t seem to help much since it seems like org-roam-dailies-find-today
just uses whatever template is the first in that list?
Ok, I think I’ve hacked up some solution to this. My emacs-fu is super basic though so would be glad if someone can simplify this a bit. Basically, this is based on org-roam-dailies-find-today
using the first of org-roam-dailies-capture-templates
(as I seem to have correctly figured out in the beginning). So we define our own me/org-roam-dailies-find-today
function that re-binds org-roam-dailies-capture-templates
in a let
scope and then calls org-roam-dailies-find-today
(defun spolakh/org-roam-dailies-find-today ()
(interactive)
(spolakh/org-roam-find-day-wrapper 'org-roam-dailies-find-today (spolakh/daily-template-text-for-day 0))
)
(defun spolakh/org-roam-find-day-wrapper (finder-function custom-text)
(let ((org-roam-dailies-capture-templates (spolakh/compile-daily-template custom-text)))
(funcall finder-function)
))
(defun spolakh/daily-template-text-for-day (offset-days)
(let* (
(newts (ts-adjust 'day offset-days (ts-now)))
(dow (ts-dow newts))
; 0 is sunday
(text-with-weekly (if (= dow 0) "\n\n[[roam:§ PRIVATE/Nice Things This Week]] 1: 2: 3:" ""))
(last-day-this-month (calendar-last-day-of-month (ts-month newts) (ts-year newts)))
(d (ts-day newts))
(is-last-sunday (and (= dow 0) (< (- last-day-this-month d) 7)))
(text-with-monthly (if is-last-sunday (concat text-with-weekly "\n\n[[roam:§ PRIVATE/Nice Things This Month]] 1: 2: 3:") text-with-weekly))
)
text-with-monthly)
)