Compare commits

...

2 Commits

Author SHA1 Message Date
28b2047ad6
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.)
2023-01-11 20:44:19 +01:00
6ed088d2da
Fix missing summation of time blocks in agenda 2023-01-11 20:22:29 +01:00

View File

@ -200,7 +200,7 @@ shown because they are due)."
(save-excursion (save-excursion
(while (< (point) limit) (while (< (point) limit)
(when (member (org-get-at-bol 'type) (when (member (org-get-at-bol 'type)
'("scheduled" "past-scheduled" "timestamp" "deadline")) '("scheduled" "past-scheduled" "timestamp" "deadline" "block"))
(push (org-entry-get (org-get-at-bol 'org-hd-marker) "Effort") total)) (push (org-entry-get (org-get-at-bol 'org-hd-marker) "Effort") total))
(forward-line))) (forward-line)))
(org-duration-from-minutes (org-duration-from-minutes
@ -218,6 +218,17 @@ Add this function to `org-agenda-finalize-hook' to enable this."
(point) (point-max) 'org-agenda-date-header t)) (point) (point-max) 'org-agenda-date-header t))
(goto-char pos) (goto-char pos)
(end-of-line) (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 (insert-and-inherit
(concat " (" (concat " ("
(db/org-agenda-calculate-efforts (db/org-agenda-calculate-efforts