Extend documentation for agenda effort summation functions

This commit is contained in:
Daniel - 2021-01-29 17:38:24 +01:00
parent 6ba5fdad61
commit 9efb765b5a
No known key found for this signature in database
GPG Key ID: 1C7071A75BB72D64
1 changed files with 9 additions and 7 deletions

View File

@ -186,14 +186,16 @@ _y_: ?y? year _q_: quit _L__l__c_: ?l?
;; cf. https://emacs.stackexchange.com/questions/21380/show-sum-of-efforts-for-a-day-in-org-agenda-day-title#21902 ;; cf. https://emacs.stackexchange.com/questions/21380/show-sum-of-efforts-for-a-day-in-org-agenda-day-title#21902
(defun db/org-agenda-calculate-efforts (limit) (defun db/org-agenda-calculate-efforts (limit)
"Sum efforts of scheduled entries up to LIMIT in the agenda buffer." "Sum efforts of day entries up to LIMIT in the agenda buffer.
Entries included are those scheduled for that day, scheduled at
some past day (and still on display) and active timestamps (appointments)."
(let (total) (let (total)
(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")) '("scheduled" "past-scheduled" "timestamp"))
(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
(cl-reduce #'+ (cl-reduce #'+
(mapcar #'org-duration-to-minutes (mapcar #'org-duration-to-minutes
@ -202,7 +204,7 @@ _y_: ?y? year _q_: quit _L__l__c_: ?l?
(defun db/org-agenda-insert-efforts () (defun db/org-agenda-insert-efforts ()
"Insert efforts for each day into the agenda buffer. "Insert efforts for each day into the agenda buffer.
Add this function to `org-agenda-finalize-hook'." Add this function to `org-agenda-finalize-hook' to enable this."
(save-excursion (save-excursion
(let (pos) (let (pos)
(while (setq pos (text-property-any (while (setq pos (text-property-any