From a616a3c3edbe05652a2056b0b25593c528ceb310 Mon Sep 17 00:00:00 2001 From: Matt Kosarek Date: Wed, 31 Dec 2025 10:19:18 -0500 Subject: Fixing journal previous day and updating the book creator --- lisp/org-custom.el | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'lisp/org-custom.el') diff --git a/lisp/org-custom.el b/lisp/org-custom.el index d927a7c..d999a83 100644 --- a/lisp/org-custom.el +++ b/lisp/org-custom.el @@ -87,6 +87,22 @@ ;; alert-default-style 'libnotify) ;; (org-alert-enable)) +(defun my/org-roam-dailies-previous-file () + "Return filename of the most recent existing org-roam daily before today." + (let* ((dir (file-name-as-directory org-roam-directory)) + (time (current-time)) + (found nil) + (i 1)) + (while (and (not found) (< i 366)) + (let* ((date (format-time-string "%Y-%m-%d" + (time-subtract time (days-to-time i)))) + (file (expand-file-name (concat date ".org") dir))) + (when (file-exists-p file) + (setq found file))) + (setq i (1+ i))) + found)) + + (use-package org-roam :ensure t :custom @@ -106,7 +122,7 @@ '(("d" "default" entry "* %?" :target (file+head "%<%Y-%m-%d>.org" - "#+title: %<%Y-%m-%d> 📰 \n#+filetags: :dailies: \n\n[[file:%(format-time-string \"%Y-%m-%d\" (time-subtract (current-time) (days-to-time 1))).org][← Previous Day]]\n\n* Tasks 🎯\n\n* Notes 📁\n\n")))) + "#+title: %<%Y-%m-%d> 📰 \n#+filetags: :dailies: \n\n[[file:%(my/org-roam-dailies-previous-file)][← Previous Day]]\n\n* Tasks 🎯\n\n")))) (setq org-roam-capture-templates '(("d" "default" plain "%?" @@ -117,7 +133,7 @@ :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title} 🎫\n #+filetags: :issues:ticket:project:canonical\n") :unnarrowed t) ("b" "book" plain - "\n\n* Overview \n " + "\n\n* Overview \n\n* Rating \n\n* Links \n " :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title} 📚\n #+filetags: :books\n") :unnarrowed t))) (org-roam-setup) -- cgit v1.2.1