I want to sum clock times for items which are in state TODO in the agenda.

Using org-clocksum-curret-item as a template:

  (defun org-clock-sum-current-item (&optional tstart)
    "Return time, clocked on current item in total."
    (save-excursion
      (save-restriction
        (org-narrow-to-subtree)
        (org-clock-sum tstart)
        org-clock-file-total-minutes)))

The following works the same as above (nil start and end time):

  (defun my-org-clock-sum-current-item-in-state ()
    (save-excursion
      (save-restriction
        (org-narrow-to-subtree)
        (org-clock-sum nil nil)
        org-clock-file-total-minutes)))

This version with a filter reports zero clocked time, as expected:

  (defun my-org-clock-sum-current-item-in-state ()
    (save-excursion
      (save-restriction
        (org-narrow-to-subtree)
        (org-clock-sum nil nil (lambda () nil))
        org-clock-file-total-minutes)))

And this version with a filter goes into an infinite loop some where
in org-clock-sum after processing several items:

  (defun my-org-clock-sum-current-item-in-state ()
    (save-excursion
      (save-restriction
        (org-narrow-to-subtree)
        (org-clock-sum nil nil (lambda () t))
        org-clock-file-total-minutes)))

I would like to use a filter like:

  (lambda () (string-equal "TODO" (org-get-todo-state)))

But it looks like no filters are working.

------------------------------------------------------------------------



Emacs  : GNU Emacs 24.4.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.14.5)
 of 2014-11-19 on buildvm-03.phx2.fedoraproject.org
Package: Org-mode version 8.2.10 (8.2.10-34-gc41bbc-elpa @
/home/me/.emacs.d/elpa/org-20150223/)

Reply via email to