I use org-mode since 2012. I recently adopted the org-mode clocking work time capabilities and thus have created the following org-capture-template:

(setq org-capture-templates '("j" "Journal" entry (file (concat
  org-directory "/journal.org")) "* %?\n%u\n" :clock-in t :clock-resume t))

(define-key global-map "\C-cr" 'org-capture)

When I start working on something (eg. Project A), I press C-c r j and the timer starts. When I finish, I press C-c C-c. In this simple scenario, everything works fine.

However, there are occasions where I get interrupted during Project A, without time for any key press. For example, the phone rings and I discuss an urgent issue for 10 minutes. Before I return to what I was doing before the phone call, I want to keep log of the phone call.

|  time | event                        |
| 10:00 | Clock-in                     |
| 10:15 | Interrupt                    |
| 10:25 | RETI (return from interrupt) |

It is now 10:25 and the corresponding entry in journal.org is:

* Project A
  CLOCK: [2016-09-27 Tue 10:00]
  [2016-09-27 Tue]

Which is the best/recommended/straightforward way to achieve the following result?

* Phone call
  CLOCK: [2016-09-27 Tue 10:15]--[2016-09-27 Tue 10:25] =>  0:10
 [2016-09-27 Tue]

* Project A
  CLOCK: [2016-09-27 Tue 10:25]
  CLOCK: [2016-09-27 Tue 10:00]--[2016-09-27 Tue 10:15] =>  0:15
 [2016-09-27 Tue]

What is shown here is:
a) The phone call has been clocked from 10:15 - 10:25
b) The Project A has been clocked from 10:00 - 10:15
c) The Project A clock has resumed from 10:25


I believe this question is basically the same as How to manipulate clock times (org-mode)

I provided an answer under that question (currently the recognised correct answer if that helps you spot it), but the basic gist is that you create and clock in to your "interrupt" task on your return, then adjust the starting clock time of that interrupt task back to when you were actually interrupted.

If you use M-S-Up and M-S-Down on the CLOCK line of your interrupt task then, in addition to adjusting that clock time, it will also adjust the clock entry of the previously clocked-in task. In your scenario this would therefore adjust the end of "Clock-in" as it was adjusting the start time of "Interrupt".

  • TBH I have already read that answer, but I was expecting something more "elegant", like a command that lets you enter the duration (10min) of the interrupt (Phone call) and then settles everything out. Anyway, I think I can live with the M-S-Up/Down solution. Sep 29 '16 at 6:38
  • Yes, something more elegant would be nice, but as far as I know this "bumping" is all there is. Still, it's pretty nice that it at least does the right thing by adjusting the interrupted task's clock line too. Sep 29 '16 at 7:16
  • While looking around for a better solution, I found org-clock-convenience which seems very nice. Sep 30 '16 at 11:49
  • Org-clock-convenience does indeed look very interesting -- thanks for pointing it out to me. Sep 30 '16 at 12:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.