From a00473f1afd8e9104123b99ebfcda0ac91205e99 Mon Sep 17 00:00:00 2001 From: Daniel Fleischer Date: Sun, 8 Jan 2023 19:50:11 +0200 Subject: [PATCH] Bug fix: repeating events appeared multiple times The bug was that a repeating event appeared multiple times at the first day it was scheduled/deadline; the reason is this package scrapes the agenda for data and in day-mode an individual repeating events appears in all the future dates so need to dedup it. --- calfw-org.el | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/calfw-org.el b/calfw-org.el index 5a16a77..24ae664 100644 --- a/calfw-org.el +++ b/calfw-org.el @@ -96,20 +96,23 @@ For example, "[internal] Return org schedule items between BEGIN and END." (let ((org-agenda-prefix-format " ") (org-agenda-include-inactive-timestamps - cfw:org-agenda-inactive-timestamps) + cfw:org-agenda-inactive-timestamps) (span 'day)) (setq org-agenda-buffer - (when (buffer-live-p org-agenda-buffer) - org-agenda-buffer)) + (when (buffer-live-p org-agenda-buffer) + org-agenda-buffer)) (org-compile-prefix-format nil) - (loop for date in (cfw:enumerate-days begin end) append - (loop for file in (or cfw:org-icalendars (org-agenda-files nil 'ifmode)) - append - (progn - (org-check-agenda-file file) - (apply 'org-agenda-get-day-entries - file date - cfw:org-agenda-schedule-args)))))) + (delete-duplicates + (loop for date in (cfw:enumerate-days begin end) append + (loop for file in (or cfw:org-icalendars (org-agenda-files nil 'ifmode)) + append + (progn + (org-check-agenda-file file) + (apply 'org-agenda-get-day-entries + file date + cfw:org-agenda-schedule-args)))) + :from-end t + :test (lambda (x y) (equal (cfw:org-tp x 'date) (cfw:org-tp y 'date)))))) (defun cfw:org-onclick () "Jump to the clicked org item."