From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: [PATCH] clock reports: Only include current clocking task when range includes task Date: Sun, 16 May 2010 22:12:23 -0400 Message-ID: <1274062343-8894-1-git-send-email-bernt@norang.ca> References: <87r5lb9t4u.fsf@gollum.intra.norang.ca> Return-path: Received: from [140.186.70.92] (port=57758 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ODpol-0007Br-34 for emacs-orgmode@gnu.org; Sun, 16 May 2010 22:12:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ODpoj-0005Et-6P for emacs-orgmode@gnu.org; Sun, 16 May 2010 22:12:30 -0400 Received: from mho-02-ewr.mailhop.org ([204.13.248.72]:60938) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ODpoj-0005Ep-4k for emacs-orgmode@gnu.org; Sun, 16 May 2010 22:12:29 -0400 Received: from cpe000102d0fe75-cm0012256ecbde.cpe.net.cable.rogers.com ([99.239.148.180] helo=mail.norang.ca) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1ODpoi-00081S-Se for emacs-orgmode@gnu.org; Mon, 17 May 2010 02:12:28 +0000 In-Reply-To: <87r5lb9t4u.fsf@gollum.intra.norang.ca> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Cc: Bernt Hansen When org-clock-report-include-clocking-task is set we always add the current clocking task to the clock report. This is incorrect if you are looking at an agenda clock report for a time range that does not include the current clocking task (e.g. yesterday or last week). Now we only include the current clocking task if the clock report date range includes the current clocking task start time. --- Update patch without the debug call to the (message) This patch is available at git://git.norang.ca/org-mode.git for-carsten -Bernt lisp/org-clock.el | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 504f0c9..07e2e45 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1396,12 +1396,15 @@ nil are excluded from the clock summation." (* 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 ((org-clock-start-time-as-float (org-float-time org-clock-start-time))) + (when (and org-clock-report-include-clocking-task + (equal (org-clocking-buffer) (current-buffer)) + (equal (marker-position org-clock-hd-marker) (point)) + (>= org-clock-start-time-as-float tstart) + (<= org-clock-start-time-as-float tend)) (let ((time (floor (- (org-float-time) - (org-float-time org-clock-start-time)) 60))) - (setq t1 (+ t1 time)))) + org-clock-start-time-as-float) 60))) + (setq t1 (+ t1 time))))) (let* ((headline-forced (get-text-property (point) :org-clock-force-headline-inclusion)) -- 1.7.1.86.g0e460