Re: Parse malformed clocklines (was: Re: [PATCH] lisp/org-clock.el (org-clock-sum): Rewrite regex using rx)

2024-06-26 Thread Ihor Radchenko
Morgan Smith writes: >> I think that the best course of action when a problematic timestamp >> without opening/closing time is encountered is: >> >> 1. Warn user >> 2. Still calculate the duration, assuming 0s in time (simply because >>previous versions of Org mode did it) >> >> (2) is kind o

Parse malformed clocklines (was: Re: [PATCH] lisp/org-clock.el (org-clock-sum): Rewrite regex using rx)

2024-06-24 Thread Morgan Smith
Ihor Radchenko writes: > Morgan Smith writes: > >>> That's expected. >>> We have the following _syntax_ description for clock lines: >>> >>> https://orgmode.org/worg/org-syntax.html#Clocks...>> clock: >>> INACTIVE-TIMESTAMP-RANGE DURATION >> ... >> My specific issue is that the ":*-end" stuff c

Re: [PATCH] lisp/org-clock.el (org-clock-sum): Rewrite regex using rx

2024-06-20 Thread Ihor Radchenko
Morgan Smith writes: >> That's expected. >> We have the following _syntax_ description for clock lines: >> >> https://orgmode.org/worg/org-syntax.html#Clocks... >> clock: INACTIVE-TIMESTAMP-RANGE DURATION > ... > My specific issue is that the ":*-end" stuff can be set when the > "*-start" stuff i

Re: [PATCH] lisp/org-clock.el (org-clock-sum): Rewrite regex using rx

2024-06-19 Thread Morgan Smith
Ihor Radchenko writes: >> Ideally the fix in that commit should be ported to the org-element API. >> Notably, the malformed clock from the email thread from that commit is >> parsed a little strangely by org-element. I'm not sure what effect this >> has on my rewrite patch but regardless, we sho

Re: [PATCH] lisp/org-clock.el (org-clock-sum): Rewrite regex using rx

2024-06-19 Thread Ihor Radchenko
Morgan Smith writes: > So I gave up on this specific patch because I wrote a patch to just > rewrite the entire `org-clock-sum' function using org-element API. > Attached is the `org-clock-sum' rewrite patch which I've been using for > a while with no issues. I have half finished patches locally

Re: [PATCH] lisp/org-clock.el (org-clock-sum): Rewrite regex using rx

2024-06-19 Thread Morgan Smith
Ihor Radchenko writes: > Ping ;) So I gave up on this specific patch because I wrote a patch to just rewrite the entire `org-clock-sum' function using org-element API. Attached is the `org-clock-sum' rewrite patch which I've been using for a while with no issues. I have half finished patches lo

Re: [PATCH] lisp/org-clock.el (org-clock-sum): Rewrite regex using rx

2024-06-18 Thread Ihor Radchenko
Morgan Smith writes: > Ihor Radchenko writes: > >> So, in the message I linked, Nicolas (the major Org mode contributor) >> was not right. I hence need to fix the parser and update Org syntax >> page. This includes fixing `org-element-clock-line-re' to account for >> CLOCK: => 1:00 syntax. > > C

Re: [PATCH] lisp/org-clock.el (org-clock-sum): Rewrite regex using rx

2024-04-14 Thread Ihor Radchenko
Ihor Radchenko writes: > So, in the message I linked, Nicolas (the major Org mode contributor) > was not right. I hence need to fix the parser and update Org syntax > page. This includes fixing `org-element-clock-line-re' to account for > CLOCK: => 1:00 syntax. I changed the parser on main. http

Re: [PATCH] lisp/org-clock.el (org-clock-sum): Rewrite regex using rx

2024-04-13 Thread Morgan Smith
Ihor Radchenko writes: > So, in the message I linked, Nicolas (the major Org mode contributor) > was not right. I hence need to fix the parser and update Org syntax > page. This includes fixing `org-element-clock-line-re' to account for > CLOCK: => 1:00 syntax. Cool. I guess ping this thread wh

Re: [PATCH] lisp/org-clock.el (org-clock-sum): Rewrite regex using rx

2024-04-13 Thread Ihor Radchenko
Morgan Smith writes: >>> - (goto-line 2) >>> + (insert (org-test-clock-create-clock ". 1:00" ". 2:00") >>> + "CLOCK: => 1:00\n") >> >> This is not a valid clock format. Matching such lines is a bug. >> See https://list.orgmode.org/orgmode/87wpkkhafc.fsf@saiph.selenimh/ > >

Re: [PATCH] lisp/org-clock.el (org-clock-sum): Rewrite regex using rx

2024-04-13 Thread Morgan Smith
Ihor Radchenko writes: >> * testing/lisp/test-org-clock.el (test-org-clock/clocktable/insert): >> Add a clock time that does not include timestamps. >> ... >> - >> - (goto-line 2) >> + (insert (org-test-clock-create-clock ". 1:00" ". 2:00") >> + "CLOCK: => 1:00\n") > > This

Re: [PATCH] lisp/org-clock.el (org-clock-sum): Rewrite regex using rx

2024-04-13 Thread Ihor Radchenko
Morgan Smith writes: > See two attached patches. All tests pass on my computer. > > Every once in a while I feel obligated to go back to org-clock-sum to > try and optimize it. I have a file with 8 clocktables in it and it > takes forever to update. This time I decided instead of trying to > o

[PATCH] lisp/org-clock.el (org-clock-sum): Rewrite regex using rx

2024-04-11 Thread Morgan Smith
Hello! See two attached patches. All tests pass on my computer. Every once in a while I feel obligated to go back to org-clock-sum to try and optimize it. I have a file with 8 clocktables in it and it takes forever to update. This time I decided instead of trying to optimize, I'm just going to