Clock: Fix bugs when resuming the clock.
commit633e8cdd905a9589a933b63ae886b854fa345cae
authorCarsten Dominik <carsten.dominik@gmail.com>
Tue, 14 Apr 2009 07:50:05 +0000 (14 09:50 +0200)
committerCarsten Dominik <carsten.dominik@gmail.com>
Tue, 14 Apr 2009 07:50:05 +0000 (14 09:50 +0200)
tree660ae193120412b8bcf07a0a0752a7fd204f5fe8
parent5ad8aaf20fa959373ace9eb7eb70368c7cdc522a
Clock: Fix bugs when resuming the clock.

Adam Elliot writes:

>  Automatically resuming the clock after an Emacs restart
>  fails under the following cases:
>
>  1. If org-log-states-order-reversed set to t (default), and
>     a state change line precedes the clock line to resume.
>     Error message is "Cannot restart clock because task does
>     not contain unfinished clock".
>
[...]
>  2. If org-log-states-order-reversed set to nil.  Error
>     message is the same.  Reason: point is placed *after*
>     last clock line and so fails looking-at test.
>

This commit fixes the problem, in a slightly different way
than Adam proposed.  Instead of trying to fix the old way to
find the position of the clock, we now simple search the
entry if there is an unfinished clock and go there.  Since
new clocks are added before older ones, this should be a
safe bet.
lisp/ChangeLog
lisp/org-clock.el