diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2010-02-27 13:21:31 +0100 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2010-02-27 13:21:31 +0100 |
commit | 93c721fabfc403e7682279e1794e0b1dfaaebe5a (patch) | |
tree | bc03e22df5ca4eedb6eee06a912c15a4ece3d8e4 | |
parent | 6d1e30828bc7ae7aceabacb3014a9e9451e624e0 (diff) | |
download | org-mode-93c721fabfc403e7682279e1794e0b1dfaaebe5a.tar.gz |
Clock: Allow to add the current clock when preparing a report
This is dependent on the new variable
`org-clock-report-include-clocking-task', default nil.
Patch by Bernt Hansen.
-rwxr-xr-x | lisp/ChangeLog | 6 | ||||
-rw-r--r-- | lisp/org-clock.el | 12 |
2 files changed, 18 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f6d579b..a6bd0e7 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2010-02-27 Carsten Dominik <carsten.dominik@gmail.com> + + * org-clock.el (org-clock-report-include-clocking-task): New + option. + (org-clock-sum): Add the current clocking task. + 2010-02-26 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-cycle): Print a message when in a table.el table. diff --git a/lisp/org-clock.el b/lisp/org-clock.el index cb378e6..0244f31 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -240,6 +240,11 @@ string as argument." (const :tag "Always" t) (const :tag "When no clock is running" when-no-clock-is-running))) +(defcustom org-clock-report-include-clocking-task nil + "When non-nil, include the current clocking task time in clock reports." + :group 'org-clock + :type 'boolean) + (defvar org-clock-in-prepare-hook nil "Hook run when preparing the clock. This hook is run before anything happens to the task that @@ -1341,6 +1346,13 @@ TSTART and TEND can mark a time range to be considered." (setq t1 (+ t1 (string-to-number (match-string 5)) (* 60 (string-to-number (match-string 4)))))) (t ;; A headline + ;; Add the currently clocking item time to the total + (when (and org-clock-report-include-clocking-task + (equal (org-clocking-buffer) (current-buffer)) + (equal (marker-position org-clock-hd-marker) (point))) + (let ((time (floor (- (org-float-time) + (org-float-time org-clock-start-time)) 60))) + (setq t1 (+ t1 time)))) (setq level (- (match-end 1) (match-beginning 1))) (when (or (> t1 0) (> (aref ltimes level) 0)) (loop for l from 0 to level do |