Using emacs org mode for about a month now to track all my projects and tasks.
I clock all activities throughout my day, not just work related ones.
My question is- I often forget to clock-in to a new activity (say, taking lunch). When I return and clock back in to a work activity, I need to first clock in to lunch and then adjust the starting time stamp for it. This is fine for the lunch activity, but it doesn't adjust the previous work work related task before I took lunch, so the net is that the previous task overlaps lunch and is inaccurate.
Is there a way to change the behavior so that it does adjust the previous task? I don't wish to use the idle feature to do this; I'd prefer to have the adjustment happen automatically.
ETA: This also came up again on the mailing list and there appears to be a recent commit to the code base that provides another [perhaps better] way to do this. See the mailing list discussion for Bastien's (org-mode maintainer) input:
S-M-[up/down] on a clock timestamp will try to update the previous/next clock timestamp too.
(Actually, bzg's
suggestion below is this exact thing... it just didn't have the shortcut above included, so I think his answer looks harder/less attractive than the above, which is really easy.)
You can also use org-resolve-clocks
. See Resolving idle time.
Essentially, you have some headline and are clocked in:
* Work
:LOGBOOK:
CLOCK: [2012-07-25 Wed 8:26]
:END:
I come back from lunch and realize I forgot to clock out of work and into lunch.
I run M-x org-resolve-clocks
and get this prompts:
Select a Clock Resolution Command:
i/q/C-g Ignore this question; the same as keeping all the idle time.
k/K Keep X minutes of the idle time (default is all). If this
amount is less than the default, you will be clocked out
that many minutes after the time that idling began, and then
clocked back in at the present time.
g/G Indicate that you "got back" X minutes ago. This is quite
different from 'k': it clocks you out from the beginning of
the idle period and clock you back in X minutes ago.
s/S Subtract the idle time from the current clock. This is the
same as keeping 0 minutes.
C Cancel the open timer altogether. It will be as though you
never clocked in.
j/J Jump to the current clock, to make manual adjustments.
For all these options, using uppercase makes your final state
to be CLOCKED OUT.
Since I want to K
eep X minutes of Work, clock out, and then clock into Lunch, I press K
, which prompts me with (it's ~1:30p right now):
Keep how many minutes? (default 303)
I can hit enter to keep all of them, but let's say I took lunch around 12p. That's about 3.5hrs of work, so I'll enter 210 RET
.
Now, I clock into Lunch and get this prompt:
You stopped another clock 101 minutes ago; start this one from them? (y or n)
I enter y RET
and Lunch gets clocked in at 11:56a. If you're back from lunch and working again (or started working and forgot), repeat the process:
M-x org-resolve-clocks
K
____ RET ;; for how many minutes you at lunch
C-c C-x C-i ;; to clock in on Work again
y RET ;; clock in at when you stopped lunch
The final result:
* Work
:LOGBOOK:
CLOCK: [2012-07-25 Wed 12:41]
CLOCK: [2012-07-25 Wed 8:26]--[2012-07-25 Wed 11:56] => 3:30
:END:
* Lunch
:LOGBOOK:
CLOCK: [2012-07-25 Wed 11:56]--[2012-07-25 Wed 12:41] => 0:45
:END:
Hope this helps. The org-mode clocking wizard, Bernt Hansen, explained this to me via an org-mode mailing list thread.
This is now implemented (check http://orgmode.org/w/?p=org-mode.git;a=commit;h=3528fc).
(setq org-clock-continuously t)
in your .emacs.el and new clocks will start from the time when the last clock was closed.
C-u C-u C-u M-x org-clock-in RET
and C-u C-u M-x org-clock-in-last RET
will also do this, even when org-clock-continuously
is set to nil
.
If I understand your question correctly, you want to adjust the timestamp after clocking out. There is a command for this; you can check out the functions:
org-timestamp-up
org-timestamp-down
I thought these were bound by default, but it appears they are not, so you will want to bind them to a key sequence, maybe something like C-c T u
and C-c T d
, or whatever floats your boat. Usage is simple, just move the cursor over the field you want to adjust by, and run up or down. It only works on the timestamp itself, NOT the calculated duration that appears on the right.
You might also check out
org-timestamp-change
which the top two functions are wrappers for. You might also need to customize the variable
org-time-stamp-rounding-minutes
By default, it will round timestamps to +/- 5 minutes from the start of your original clock-in, and you might be puzzled when modifying the timestamp.
Personally, I prefer (setq org-time-stamp-rounding-minutes '(0 1))
which will start the timer on the exact minute I clock-in (the zero), and use a granularity of 1 minute(s) for timestamp changes. Also, you can use a prefixes like C-u 4 7 C-c T u
on the minute part of timestamps, and org-mode will do the right thing - even rounding up the hour.
Summary:
(setq org-time-stamp-rounding-minutes '(0 1))
(add-hook 'org-mode-hook
'(lambda ()
(local-set-key (kbd "C-c T u") 'org-timestamp-up)
(local-set-key (kbd "C-c T d") 'org-timestamp-down)))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With