0

org-clock-sum gets the time logged for a header and all of its children. Is there a way to get the time logged ONLY for the top level header (but not its children?).

George
  • 879
  • 5
  • 17

1 Answers1

2

If by top level header you mean the outline level 1:

(org-clock-sum nil nil (lambda ()
                         (= (org-outline-level) 1)))

Otherwise:

(save-restriction
  (org-narrow-to-subtree)
  (let ((level (org-outline-level)))
    (org-clock-sum nil nil (lambda ()
                             (= (org-outline-level) level)))))

See the third argument of the org-clock-sum function:

Headlines for which HEADLINE-FILTER returns nil are excluded from the clock summation.

jagrg
  • 3,824
  • 4
  • 19