[emacs] Fix org-reminders parsing of nested timed tasks

This commit is contained in:
2026-08-09 14:07:33 -04:00
parent b7b25e8d24
commit b14cc6b6c5

View File

@ -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,7 +111,7 @@ 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)))
(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)))
@ -124,9 +124,10 @@ Each spec is (ID HEADING FIRE-TIME LABEL SECONDS)."
(push (list id heading
(- anchor (cdr interval))
(car interval) (cdr interval))
specs)))))
(goto-char subtree-end)))))
(nreverse specs)))
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)