Vagn Johansen <[EMAIL PROTECTED]> writes:

> Bastien <[EMAIL PROTECTED]> writes:
>
>> Vagn Johansen <[EMAIL PROTECTED]> writes:
>>
>>> I could also see a use for a state-dependent {:}. Display the sum of
>>> times and also the sum of times for tasks that are DONE. E.g. for
>>> adding time-estimates and measuring progress. Or maybe add up the
>>> not-DONEs to show the remaining time.
>>
>> Isn't this already achievable with a clever todo/archive structure?
>
> Sort of. But I do not want to be forced to use a specific structure.
>
> Also it gives incorrect sums if you havee subproject with with mixed
> TODO and DONE tasks.
>

I discovered that is easy to just copy the Time_Estimate value  to
Time_Spent for those tasks that are DONE.


(save-excursion
  (goto-char (point-min))
  ;; For each node
  (while (re-search-forward (concat "^" outline-regexp) nil t)
    ;; If task is done and there is no Time_Spent property
    (if (and (equal (org-entry-get (point) "TODO") "DONE")
          (not (org-entry-get (point) "Time_Spent")))
      ;; Add Time_Spent property with the value from the
      ;; Time_Estimate property if available or 999000
      (org-entry-put (point) "Time_Spent"
        (or (org-entry-get (point) "Time_Estimate") "999000")))))

-- 
Vagn Johansen



_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to