Sometimes I edit timestamps by hand when I'm clocking things. I had a task where I'd clocked in and wanted to close by hand (by adding --[2021 and so on to the CLOCK line) but when I started typing this popped up in a window: Warning (emacs): org-element--cache: Cache corruption detected in work-diary.org. Resetting. The error was: (error #("Not an Org time string: []" 24 25 (wrap-prefix #(" " 0 8 (face org-indent)) line-prefix #(" " 0 8 (face org-indent)) fontified t) 25 26 (wrap-prefix #(" " 0 8 (face org-indent)) line-prefix #(" " 0 8 (face org-indent)) fontified t))) Disable showing Disable logging "[2021" certainly isn't a time string, but the warning surprised me. I presume it's because of the recent improvements about persistence. I have no suggestions but thought I'd point it out in case it might crop up more if other people enter clock timestamps by hand. Thanks, Bill -- William Denton https://www.miskatonic.org/ Librarian, artist and licensed private investigator. Toronto, Canada
On 22 October 2021, William Denton wrote: > Sometimes I edit timestamps by hand when I'm clocking things. I had a task > where I'd clocked in and wanted to close by hand (by adding --[2021 and so on > to the CLOCK line) but when I started typing this popped up in a window: I think I was too hasty in sending this. More clocking threw a couple more warnings that then stopped, and this one hasn't happened again, so maybe it was just due to cacheing being set up for the first time somehow. Sorry about that. Bill -- William Denton https://www.miskatonic.org/ Librarian, artist and licensed private investigator. Toronto, Canada
William Denton <wtd@pobox.com> writes:
> Sometimes I edit timestamps by hand when I'm clocking things. I had a task
> where I'd clocked in and wanted to close by hand (by adding --[2021 and so on to
> the CLOCK line) but when I started typing this popped up in a window:
>
> Warning (emacs): org-element--cache: Cache corruption detected in work-diary.org. Resetting.
> The error was: (error #("Not an Org time string: []" 24 25 (wrap-prefix #("
Thanks for reporting! Such warning should not normally appear. It
_always_ indicates a bug that needs to be fixed.
Best,
Ihor
Ihor Radchenko <yantar92@gmail.com> writes:
> William Denton <wtd@pobox.com> writes:
>
>> Sometimes I edit timestamps by hand when I'm clocking things. I had a task
>> where I'd clocked in and wanted to close by hand (by adding --[2021 and so on to
>> the CLOCK line) but when I started typing this popped up in a window:
>>
>> Warning (emacs): org-element--cache: Cache corruption detected in work-diary.org. Resetting.
>> The error was: (error #("Not an Org time string: []" 24 25 (wrap-prefix #("
Confirmed.
This looks like a bug in org-element-timestamp-parser
Minimal reproducer:
1. Create an empty org file and open it
2. Yank the following string: "CLOCK: [2021-10-22 Fri 10:41]--[2021]"
3. M-: (org-element-at-point) <RET>
Best,
Ihor
[-- Attachment #1: Type: text/plain, Size: 1109 bytes --] Ihor Radchenko <yantar92@gmail.com> writes: > This looks like a bug in org-element-timestamp-parser > > Minimal reproducer: > > 1. Create an empty org file and open it > 2. Yank the following string: "CLOCK: [2021-10-22 Fri 10:41]--[2021]" > 3. M-: (org-element-at-point) <RET> The attached is tentative fix for cases like the above. It gets rid of the observed error, however I am not sure if the clock line parser returns a reasonable value is such case. With the patch, org-element-at-point returns (clock (:status running :value (timestamp ( :type inactive :raw-value "[2021-10-22 Fri 10:41]" :year-start 2021 :month-start 10 :day-start 22 :hour-start 10 :minute-start 41 :year-end 2021 :month-end 10 :day-end 22 :hour-end 10 :minute-end 41 :begin 301 :end 323 :post-blank 0)) :duration nil :begin 294 :end 331 :post-blank 0 :post-affiliated 294)) Should we consider the above CLOCK line as a valid running clock or maybe it should be parsed as a paragraph? Best, Ihor [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-org-element-Fix-org-element-timestamp-parser-for-inc.patch --] [-- Type: text/x-diff, Size: 1257 bytes --] From 91749491eb95cf1088fbe5a479eb30816478dba7 Mon Sep 17 00:00:00 2001 Message-Id: <91749491eb95cf1088fbe5a479eb30816478dba7.1637670436.git.yantar92@gmail.com> From: Ihor Radchenko <yantar92@gmail.com> Date: Tue, 23 Nov 2021 20:25:41 +0800 Subject: [PATCH] org-element: Fix org-element-timestamp-parser for incomplete ranges * lisp/org-element.el (org-element-timestamp-parser): Use more strict regexp to match second timestamp in timestamp--timestamp range. Fixes https://list.orgmode.org/orgmode/87tuh88kjv.fsf@localhost/ --- lisp/org-element.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index b47fba9eb..b40ff2d33 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -3900,7 +3900,9 @@ (defun org-element-timestamp-parser () (activep (eq (char-after) ?<)) (raw-value (progn - (looking-at "\\([<[]\\(%%\\)?.*?\\)[]>]\\(?:--\\([<[].*?[]>]\\)\\)?") + (looking-at (concat "\\([<[]\\(%%\\)?.*?\\)[]>]\\(?:--\\(" + org-ts-regexp-both + "\\)\\)?")) (match-string-no-properties 0))) (date-start (match-string-no-properties 1)) (date-end (match-string 3)) -- 2.32.0
Ihor Radchenko <yantar92@gmail.com> writes:
> Should we consider the above CLOCK line as a valid running clock or
> maybe it should be parsed as a paragraph?
Nicolas, do you have any comment on this? I am inclined to treat
CLOCK: [2021-10-22 Fri 10:41]--[2021]
as a paragraph, not a clock line.
Best,
Ihor
Ihor Radchenko <yantar92@gmail.com> writes: >> Minimal reproducer: >> >> 1. Create an empty org file and open it >> 2. Yank the following string: "CLOCK: [2021-10-22 Fri 10:41]--[2021]" >> 3. M-: (org-element-at-point) <RET> > > The attached is tentative fix for cases like the above. Applied onto main via 4dda0d7a8. This may also fix https://list.orgmode.org/8735grjq2e.fsf@no.workgroup/T/#u > Should we consider the above CLOCK line as a valid running clock or > maybe it should be parsed as a paragraph? I am still leaving this question open despite applying the above patch. At least, we need to get the bug fixed. Best, Ihor
Ihor Radchenko <yantar92@gmail.com> writes: >> Should we consider the above CLOCK line as a valid running clock or >> maybe it should be parsed as a paragraph? > > I am still leaving this question open despite applying the above patch. > At least, we need to get the bug fixed. I now made Org parse malformed CLOCK lines as paragraphs. https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=e305755b1a7ac41c74ebf9a39e8b9d547acb523d -- Ihor Radchenko, Org mode contributor, Learn more about Org mode at https://orgmode.org/. Support Org development at https://liberapay.com/org-mode, or support my work at https://liberapay.com/yantar92