See the new manual section on "Resolving idle time".
(org-clock-resolve-clock): If keeping or subtracting time results in a
clock out at a time in the past, and if the resolution occurred due to
idleness or invoking `M-x org-resolve-clocks', remember that past moment
in time. On the next clock in, the user will be prompted to see if they
want to back-date their new clock to then.
(org-clock-resolve): Do not jump the user to the location of a dangling
clock if the resolution is occuring due to an idle timeout. In that
case there is typically only one dangling clock, the active one, and
there is no value gained by shuffling their windows around to show it to
them. Being prompted to resolve an idle clock should be as inobtrusive
as possible.
(org-resolve-clocks-if-idle): New function that resolves only the
currently active clock if the user has exceeded the time returned by
`org-user-idle-seconds', based on the value of `org-clock-idle-time'.
(org-clock-in): If, after resolving clocks,
(org-clock-out): Cancel the `org-clock-idle-timer' on clock out.
(org-clock-resolve-clock): New function that resolves a clock to a
specific time, closing or resuming as need be, and possibly even
starting a new clock.
(org-clock-resolve): New function used by `org-resolve-clocks' that sets
up for the call to `org-clock-resolve-clock'. It determines the time to
resolve to based on a single-character selection from the user to either
keep time, subtract away time or cancel the clock.
(org-resolve-clocks): New user command which resolves dangling clocks --
that is, open but not active -- anywhere in the file list returned by
`org-files-list'.
(org-clock-in): Automatically resolve dangling clocks whenever a user
clocks in.
(org-clock-cancel): If the user cancels the solely clock in a LOGBOOK,
remove the empty drawer.
(org-clock-idle-time): New user customizable option for detecting
whether the user has left a clock idle. Note: it is only used in this
commit to test whether it's worthwhile to check OS X to get the Mac
user's current idle time. If the Emacs idle time is less than the
value, the user hasn't been away long enough to be worth checking (a
more expensive test than just getting Emacs idle time).
(org-user-idle-seconds, org-mac-idle-seconds)
(org-emacs-idle-seconds): This three functions, in conjunction
with the user customization variable `org-clock-idle-time', return
the number of seconds (as a floating point) that the user has been
away from their Emacs (or, if running on OS X, their computer).
(org-find-open-clocks): New function that returns a list of all open
clocks in the given FILE. Note that each clock it returns is a cons
cell of the format (MARKER . START-TIME). This "clock" value is used by
several of the new clock module utility functions.
(org-is-active-clock): New inline function which tests whether the given
clock value is the same as the currently active clock. Returns non-nil
if this is the case.
(org-with-clock-position): New macro that evaluates FORMS with point in
the buffer and at the position of the given clock. Changes to the
current clock are global.
(org-with-clock): New macro that evaluates FORMS with point in the
buffer and at the position of the given clock. However, changes to the
current clock are local and have no effect on the user's active clock.
This allows, for example, far any clock to be cancelled without
cancelling the active clock.
(org-clock-clock-in): New inline function that switches the active clock
to the given clock. If either the argument RESUME, or the global
`org-clock-in-resume', are non-nil, it will resume a clock that was
previously left open.
(org-clock-clock-out): New inline function that clocks out the given
clock value without affecting the currently active clock.
(org-clock-clock-cancel): New inline function that cancels the given
clock value without affecting the currently active clock.
(org-clock-out): Accept new third parameter `at-time', which permits a
clock to be clocked out at a specific time. Note that no attempt is
made to verify that the clock out time is later than the clock in time.
Bernt Hansen writes:
> If you narrow to subtree when there is a following task the narrowed
> buffer has a blank line at the end. If you are on this line and
> clock-in it starts the clock for the _following_ task (outside the
> narrowed subtree) and not the task you are looking at.
>
> I stumbled across this today because the following task was already
> over the estimated limit when I clocked it in - which triggered my
> alarm sound.
>
> ,----[ test.org ]
> | #+STARTUP:
> | * TODO One
> | * TODO Two
> `----
>
> ,----[ minimal.emacs ]
> | (add-to-list 'load-path (expand-file-name "~/git/org-mode/lisp"))
> | (add-to-list 'auto-mode-alist
> | '("\\.\\(org\\|org_archive\\|txt\\)$" . org-mode))
> | (require 'org-install)
> |
> | (global-set-key "\C-cl" 'org-store-link)
> | (global-set-key "\C-ca" 'org-agenda)
> | (global-set-key "\C-cb" 'org-iswitchb)
> `----
>
> Key sequence to reproduce:
>
> $ emacs -q -l minimal.emacs test.org
>
> | Key | Notes |
> |-------------------------------+-------------------------------|
> | C-n | Go to first task '* TODO One' |
> | M-x org-narrow-to-subtree RET | Narrow to subtree |
> | C-n | Move to last blank line |
> | C-c C-x C-i | Clock in (next) task |
> |-------------------------------+-------------------------------|
>
> -Bernt
>
> Emacs : GNU Emacs 22.2.1 (i486-pc-linux-gnu, GTK+ Version 2.12.11)
> of 2008-11-09 on raven, modified by Debian
> Package: Org-mode version 6.31trans (release_6.31.8.g7485)
Jeff Kowalczyk writes:
> I frequently use clocktables, and always use scope: subtree. The
> default scope is file.
>
> If it doesn't exist already (I didn't find it with grep), an org
> customization variable for this preference would be very helpful.
Emacs recently (when?) changed the abbreviated format for days.
The clock was confused when trying to mach this format. This patch
by Nicolas Goaziou fixes it.
Using :timetamp t as an option in a clock report now allows
insertion of the timestamp for the clocked entry. Timestamps
are searched for in this order: SCHEDULING, TIMESTAMP, DEADLINE
and TIMESTAMP_IA.
This option lets the user customize the notification mechanism.
For example, she might want to use todochiku.el.
This option defaults to nil, hence doesn't change the previous
behavior: if the program notify-send is installed on the system,
use it, and falls back on using (message [notification]) if not.
This hook is called in org-clock-in earlier than the existing
org-clock-in-hook. This is useful for functions that need to
modify the Effort property, for example.
Bernt Hansen writes:
> I have a monthly repeated task (Archive tasks) that has lots of
> old clock time on it currently but has never been marked DONE
> since the creation of the property LAST_REPEAT_TIME. If this
> task is clocking when Emacs exits and you restart emacs and
> answer Yes to continue the clock - the modeline has the total
> time for the parent task (151:04 instead of the total time for
> this task (5:04). If I clock the task in again the modeline is
> correct.