> Thank you. Please send the patch with a commit message, as described at > <https://orgmode.org/worg/org-contribute.html>.
See the attached. Let me know if anything is missing. Best, Ihor
>From 3f7b54f0100013c9a37be10256538f76abdd7112 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko <yanta...@gmail.com> Date: Sat, 15 Aug 2020 16:31:48 +0800 Subject: [PATCH] org-clock.el: Fix calculated clocking sum in inlinetasks * lisp/org-clock.el (org-clock-sum-current-item): Do not include clocked time from the parent when inside inlinetask. Calling `org-narrow-to-subtree' from inside inlinetask would narrow to the parent's subtree (correct behaviour). However, it is not what we want when calculating the clocking sum. Inlinetask case should be treated specially. --- lisp/org-clock.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 0dd495493..6a25f1e18 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1956,7 +1956,12 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes." "Return time, clocked on current item in total." (save-excursion (save-restriction - (org-narrow-to-subtree) + (if (and (featurep 'org-inlinetask) + (or (org-inlinetask-at-task-p) + (org-inlinetask-in-task-p))) + (narrow-to-region (save-excursion (org-inlinetask-goto-beginning) (point)) + (save-excursion (org-inlinetask-goto-end) (point))) + (org-narrow-to-subtree)) (org-clock-sum tstart) org-clock-file-total-minutes))) -- 2.26.2
Kyle Meyer <k...@kyleam.com> writes: > Ihor Radchenko writes: > >> I have noticed that total clocked time shown while clocked-in into >> inlinetask includes the clocked time of its parent task. >> >> Expected behaviour: only the clocking time for the inline task itself >> should be shown. >> >> This can be fixed if org-clock-sum-current-item consider the case when >> point is at inlinetask. The proposed fix is attached. > > Thank you. Please send the patch with a commit message, as described at > <https://orgmode.org/worg/org-contribute.html>.