Hi, I noticed that when I try using C-u C-u C-u `org-clock-in', I get two clocks started: one using last clock out time, and one using current time. Clocking out then closes the last one and leaves the former one dangling. This doesn't happen though when I have `org-clock-continuously' simply set to `t' and use `org-clock-in' without any prefix. So I started looking what the cause was. When triple-prefix is used, `org-clock-in' binds `org-clock-continuously' to `t' temporarily and calls itself recursively. But then it continues the execution normally once the recursive call returns. And that's what seemingly breaks things. The attached patch addresses the issue by aborting after the recursive call is over. That seemed like the easiest way to address the issue, but if it's not in the "spirit" of org-mode, I'll be happy to work on improving the patch.
Thanks, Aliaksey
>From 9aa5fb535b54df5a35c26d89f3e9ddb0e335def0 Mon Sep 17 00:00:00 2001 From: Aliaksey Artamonau <aliaksiej.artamo...@gmail.com> Date: Mon, 8 Jan 2018 16:53:20 +0300 Subject: [PATCH] org-clock.el: Fix one time continuous clock in * org-clock.el (org-clock-in): Abort after calling `org-clock-in' recursively with `org-clock-continuously' set. Without the change the recursive call to `org-clock-in' would insert a clock of last clock-out, but then the original call would continue by inserting another clock at current-time. As a result of that, clocking out uses the latter of the two clocks and leaves the other one dangling. TINYCHANGE --- lisp/org-clock.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 370473017..010304484 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1235,7 +1235,8 @@ the default behavior." (when (equal select '(64)) ;; Set start-time to `org-clock-out-time' (let ((org-clock-continuously t)) - (org-clock-in nil org-clock-out-time))) + (org-clock-in nil org-clock-out-time) + (throw 'abort nil))) (when (equal select '(4)) (setq selected-task (org-clock-select-task "Clock-in on task: ")) -- 2.15.1