From d9ffb14db5a14bd18e0c0626149a37c910d80017 Mon Sep 17 00:00:00 2001 From: hermione Date: Sun, 25 Jan 2026 14:23:55 -0800 Subject: [PATCH] refactor(emacs): remove DEADLINE logic, keep only CALDAV_UNTIL property DEADLINE doesn't limit recurring event display - agenda skip function handles that now. Simplified advice to only store CALDAV_UNTIL property. Also made debug logging unconditional to diagnose why some events don't get the property. Co-Authored-By: Claude Opus 4.5 --- home/roles/emacs/doom/config.el | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/home/roles/emacs/doom/config.el b/home/roles/emacs/doom/config.el index a95099b..0a367ab 100644 --- a/home/roles/emacs/doom/config.el +++ b/home/roles/emacs/doom/config.el @@ -181,34 +181,24 @@ ;; Handle UNTIL in recurring events ;; org-caldav ignores UNTIL from RRULE - events repeat forever. - ;; This advice extracts UNTIL and adds a DEADLINE without repeater, - ;; which Org 9.7+ interprets as the recurrence end date. - (defun my/org-caldav-add-until-deadline (orig-fun eventdata-alist) - "Advice to add DEADLINE for UNTIL in recurring events." + ;; This advice extracts UNTIL and stores it as a property for agenda filtering. + (defun my/org-caldav-add-until-property (orig-fun eventdata-alist) + "Advice to store CALDAV_UNTIL property for recurring events." (let ((result (funcall orig-fun eventdata-alist))) (let* ((rrule-props (alist-get 'rrule-props eventdata-alist)) (until-str (cadr (assoc 'UNTIL rrule-props))) (summary (alist-get 'summary eventdata-alist))) - ;; Debug: log what we're seeing (remove after debugging) - (when rrule-props - (message "CALDAV-DEBUG: %s | rrule-props: %S | until: %s" - (or summary "?") rrule-props until-str)) + ;; Debug: log what we're seeing + (message "CALDAV-DEBUG: %s | rrule-props: %S | until: %s" + (or summary "?") rrule-props until-str) (when until-str (save-excursion (org-back-to-heading t) - ;; Store original UNTIL for reference - (org-entry-put nil "CALDAV_UNTIL" until-str) - ;; Parse UNTIL: format is YYYYMMDD or YYYYMMDDTHHMMSSZ - (when (string-match "^\\([0-9]\\{4\\}\\)\\([0-9]\\{2\\}\\)\\([0-9]\\{2\\}\\)" until-str) - (let* ((year (string-to-number (match-string 1 until-str))) - (month (string-to-number (match-string 2 until-str))) - (day (string-to-number (match-string 3 until-str))) - (deadline-ts (format "<%d-%02d-%02d>" year month day))) - (org-add-planning-info 'deadline deadline-ts)))))) + (org-entry-put nil "CALDAV_UNTIL" until-str)))) result)) (advice-add 'org-caldav-insert-org-event-or-todo - :around #'my/org-caldav-add-until-deadline) + :around #'my/org-caldav-add-until-property) ) (defun my/get-rbw-password (alias)