If you clock in on a work item, and then walk away from your computer—perhaps to take a phone call—you often need to “resolve” the time you were away by either subtracting it from the current clock, or applying it to another one.
By customizing the variable
org-clock-idle-time to some integer,
such as 10 or 15, Emacs can alert you when you get back to your
computer after being idle for that many minutes80, and ask what
you want to do with the idle time. There will be a question waiting
for you when you get back, indicating how much idle time has passed
constantly updated with the current amount, as well as a set of
choices to correct the discrepancy:
To keep some or all of the minutes and stay clocked in, press k. Org asks how many of the minutes to keep. Press RET to keep them all, effectively changing nothing, or enter a number to keep that many minutes.
If you use the shift key and press K, it keeps however many minutes you request and then immediately clock out of that task. If you keep all of the minutes, this is the same as just clocking out of the current task.
To keep none of the minutes, use s to subtract all the away time from the clock, and then check back in from the moment you returned.
To keep none of the minutes and just clock out at the start of the away time, use the shift key and press S. Remember that using shift always leave you clocked out, no matter which option you choose.
To cancel the clock altogether, use C. Note that if instead of canceling you subtract the away time, and the resulting clock amount is less than a minute, the clock is still canceled rather than cluttering up the log with an empty entry.
What if you subtracted those away minutes from the current clock, and now want to apply them to a new clock? Simply clock in to any task immediately after the subtraction. Org will notice that you have subtracted time “on the books”, so to speak, and will ask if you want to apply those minutes to the next task you clock in on.
There is one other instance when this clock resolution magic occurs. Say you were clocked in and hacking away, and suddenly your cat chased a mouse who scared a hamster that crashed into your UPS’s power button! You suddenly lose all your buffers, but thanks to auto-save you still have your recent Org mode changes, including your last clock in.
If you restart Emacs and clock into any task, Org will notice that you have a dangling clock which was never clocked out from your last session. Using that clock’s starting time as the beginning of the unaccounted-for period, Org will ask how you want to resolve that time. The logic and behavior is identical to dealing with away time due to idleness; it is just happening due to a recovery event rather than a set amount of idle time.
You can also check all the files visited by your Org agenda for dangling clocks at any time using M-x org-resolve-clocks RET (or C-c C-x C-z).
You may want to start clocking from the time when you clocked out the
previous task. To enable this systematically, set
org-clock-continuously to non-
nil. Each time you clock in, Org
retrieves the clock-out time of the last clocked entry for this
session, and start the new clock from there.
If you only want this from time to time, use three universal prefix
org-clock-in and two C-u C-u with
When you often forget to clock out before being idle and you don’t
want to manually set the clocking time to take into account, you can
org-clock-auto-clockout-timer to a number of seconds and add
‘(org-clock-auto-clockout-insinuate)’ to your ‘.emacs’ file.
When the clock is running and Emacs is idle for more than this number of seconds, the clock will be clocked out automatically.
Use ‘M-x org-clock-toggle-auto-clockout RET’ to temporarily turn this on or off.
On computers using macOS, idleness is based on actual user
idleness, not just Emacs’ idle time. For X11, you can install a
utility program ‘x11idle.c’, available in the ‘org-contrib/’
repository, or install the xprintidle package and set it to the
org-clock-x11idle-program-name if you are running Debian,
to get the same general treatment of idleness. On other systems, idle
time refers to Emacs idle time only.