[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[BUG, confirmed] org-clock-in calling org-clock-sum fails leaving incomp
From: |
Ihor Radchenko |
Subject: |
[BUG, confirmed] org-clock-in calling org-clock-sum fails leaving incomplete CLOCK line when encountering existing malformed CLOCK lines |
Date: |
Fri, 03 Jun 2022 14:04:04 +0800 |
Gregor Zattler <grfz@gmx.de> writes:
>>> org-parse-time-string: Not an Org time string: [20zznn22-05-30 Mo 11:34]
>>>
>>> And then there is a dangling
>>>
>>> CLOCK:
>>>
>>> line without timestamps at the expected line in my org file.
>>>
>>> It took a while till I realized that there was a corrupted
>>> timestamp in my org file a few clock lines below.
>>
>> Could you please create an example file and detail the steps how you got
>> the error?
>
> Please see the attached test.org and call Emacs like so:
>
>
> /usr/local/bin/emacs-29.0.50 -Q -L ~/src/org-mode/lisp /tmp/test.org --eval
> '(switch-to-buffer "test.org")' -f org-clock-in
Thanks!
Confirmed using the described steps.
This is an omission in org-clock-sum.
When parsing clock lines (which org-clock-sum considers as any line
starting from word CLOCK:), org-clock-sum calls org-parse-time-string.
The latter throws the error you are seeing.
The problem have been present at lest since Org 9.1.9.
An easy fix would be catching the error and ignoring erroneous headline.
An alternative could be also throwing a warning or more informative
error.
Another alternative could be using org-element and only parsing real
clock objects + adding org-lint checker for malformed clock lines.
org-lint checker will be useful in any case though.
I do not consider this as a pressing issue, so I am just leaving the
possible solutions above. And patches are welcome :)
Best,
Ihor