From f88f8da0346363ad63f75e9d42e74206b1b45ff6 Mon Sep 17 00:00:00 2001 From: Lyz Date: Sun, 9 Mar 2025 20:06:12 +0100 Subject: [PATCH] feat(agenda): only show the overdue elements of the last three days To prevent the cluttering of overdue elements that you don't care about --- lua/orgmode/agenda/types/agenda.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lua/orgmode/agenda/types/agenda.lua b/lua/orgmode/agenda/types/agenda.lua index 53ea6388c..403716457 100644 --- a/lua/orgmode/agenda/types/agenda.lua +++ b/lua/orgmode/agenda/types/agenda.lua @@ -385,15 +385,18 @@ end function OrgAgendaType:_get_agenda_days() local dates = self.from:get_range_until(self.to) local agenda_days = {} + local three_days_before = self.from:adjust('-3d') local headline_dates = {} for _, orgfile in ipairs(self.files:all()) do for _, headline in ipairs(orgfile:get_opened_headlines()) do for _, headline_date in ipairs(headline:get_valid_dates_for_agenda()) do - table.insert(headline_dates, { - headline_date = headline_date, - headline = headline, - }) + if headline_date >= three_days_before then + table.insert(headline_dates, { + headline_date = headline_date, + headline = headline, + }) + end end end end