From b14cc6b6c59e592d6393866261af493da7782dd5 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Sun, 9 Aug 2026 14:07:33 -0400 Subject: [PATCH] [emacs] Fix org-reminders parsing of nested timed tasks --- emacs/.config/doom/+org-reminders.el | 39 ++++++++++++++-------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/emacs/.config/doom/+org-reminders.el b/emacs/.config/doom/+org-reminders.el index c8fc96f..d004501 100644 --- a/emacs/.config/doom/+org-reminders.el +++ b/emacs/.config/doom/+org-reminders.el @@ -37,7 +37,7 @@ Avoids a backlog flood after the Emacs daemon was down.") (defvar org-reminder-default-interval "15m" - "Default reminder offset applied to every timed entry without a :REMINDER: property. + "Default reminder offset for timed entries lacking a :REMINDER: property. Set to \"none\" to disable the default entirely.") (defvar org-reminder-state (make-hash-table :test 'equal) @@ -92,7 +92,7 @@ The default interval is appended unless REM suppresses it." "Regex matching a single active org timestamp.") (defun org-reminder-first-inline-ts (limit) - "Return epoch seconds of the first active timestamp at or after point, before LIMIT." + "Return epoch seconds of first active timestamp at/after point, before LIMIT." (save-excursion (let ((found nil)) (while (and (not found) @@ -111,22 +111,23 @@ Each spec is (ID HEADING FIRE-TIME LABEL SECONDS)." (goto-char (point-min)) (while (re-search-forward "^\\*+ " nil t) (let ((subtree-end (save-excursion (org-end-of-subtree t t)))) - (when (and (org-get-todo-state) (not (org-entry-is-done-p))) - (let* ((heading (string-trim (org-get-heading t t t t))) - (id (or (org-entry-get nil "ID" t) - (format "%s|%s" file heading))) - (rem (org-entry-get nil "REMINDER" t)) - (anchor (progn - (org-end-of-meta-data t) - (org-reminder-first-inline-ts subtree-end)))) - (when anchor - (dolist (interval (org-reminder-task-intervals rem)) - (push (list id heading - (- anchor (cdr interval)) - (car interval) (cdr interval)) - specs))))) - (goto-char subtree-end))))) - (nreverse specs))) + (if (and (org-get-todo-state) (not (org-entry-is-done-p))) + (let* ((heading (string-trim (org-get-heading t t t t))) + (id (or (org-entry-get nil "ID" t) + (format "%s|%s" file heading))) + (rem (org-entry-get nil "REMINDER" t)) + (anchor (progn + (org-end-of-meta-data t) + (org-reminder-first-inline-ts subtree-end)))) + (when anchor + (dolist (interval (org-reminder-task-intervals rem)) + (push (list id heading + (- anchor (cdr interval)) + (car interval) (cdr interval)) + specs))) + (goto-char subtree-end)) + (goto-char (line-end-position)))))) + (nreverse specs)))) (defun org-reminder-agenda-files () "Return the list of agenda files, refreshing it (throttled) from vulpea." @@ -227,7 +228,7 @@ Uses an mtime cache so unchanged files are not re-parsed." (org-reminder-send (format "Reminder: %s" heading) (format "Due %s — %s away" - (format-time-string "%a %e %b %H:%M" (+ fire secs)) + (format-time-string "%a %b %e %H:%M" (+ fire secs)) (org-reminder-human-delta (- (+ fire secs) now)))) (puthash key now org-reminder-state) (org-reminder-state-save)