From 28b2047ad60e90a8025d34deda62f9b5b6727fce Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Wed, 11 Jan 2023 20:44:19 +0100 Subject: [PATCH] Fix stacking of summed effort estimations upon agenda refresh When refreshing the Org agenda without completing redrawing it (i.e, by calling `org-agenda-filter-by-tag`), effort estimates where added for every refreshing, causing them to stack up. We now check whether a summed effort estimate is already present and remove it before adding it again. (Maybe one could also just skip the effort recalculation if the a summed effort estimate is already present, but I am not sure whether this will cause display inconsistencies when new events are added or old ones are deleted.) --- site-lisp/db-org.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/site-lisp/db-org.el b/site-lisp/db-org.el index 6d9a8ae..7266681 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -218,6 +218,17 @@ Add this function to `org-agenda-finalize-hook' to enable this." (point) (point-max) 'org-agenda-date-header t)) (goto-char pos) (end-of-line) + + ;; When there is already an effort sum shown, delete it first + (when (re-search-backward " ([0-9]+:[0-9]\\{2\\})" + (save-mark-and-excursion + ;; Only search until start of line + (beginning-of-line) + (point)) + t) + (kill-line)) + + ;; Insert effort sum (insert-and-inherit (concat " (" (db/org-agenda-calculate-efforts