all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Morgan Smith <morgan.j.smith@outlook.com>
Cc: emacs-orgmode@gnu.org, Sanel Zukan <sanelz@gmail.com>
Subject: Re: [PATCH] lisp/org-clock.el (org-clock-sum): Rewrite regex using rx
Date: Thu, 20 Jun 2024 09:07:41 +0000	[thread overview]
Message-ID: <87h6do7zj6.fsf@localhost> (raw)
In-Reply-To: <CH3PR84MB34240B172F1EA17489C9DD20C5CF2@CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM>

Morgan Smith <morgan.j.smith@outlook.com> 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 is not.
> ...
> CLOCK: [2023-11-15 Wed 15rr:26]--[2023-11-15 Wed 16:12] =>  0:46
> calculated time: 58320.0
> ...
> What this shows is that an invalid end will cause the entry to be
> ignored, but an invalid start will not.

Yup. Everything makes sense, but only within syntax spec. Actual code
that handles such clock lines is another story.

> We can totally claim that this is a feature, not a bug, if you would
> like.  As this essentially treats
> "CLOCK: [2023-11-15 Wed 15rr:26]--[2023-11-15 Wed 16:12] =>  0:46"
> as
> "CLOCK: [2023-11-15 Wed]--[2023-11-15 Wed 16:12] => 16:12"

I consider this as a problem that should be addressed in
`org-clock-sum' - if opening/closing time is not specified, there is
likely some typo in clock lines. So, as you saw in
fd8ddf2874ca00505aa096c6172ea750cd5e9eaa, I want to display a warning if
something is sus, so that the user is notified that time calculations
might be off.

Warning is important because a number of people use clock functionality
for billing - miscalculating clock sums can literally affect people's
income :)

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 of debatable, but I can imagine some users might make use of

such feature by putting clocks by hand:
CLOCK: [2023-11-15 Wed]--[2023-11-16 Thu] => 24:00

These users may then simply suppress the warning.

-- 
Ihor Radchenko // yantar92,
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>


  reply	other threads:[~2024-06-20  9:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-11 17:20 [PATCH] lisp/org-clock.el (org-clock-sum): Rewrite regex using rx Morgan Smith
2024-04-13 14:49 ` Ihor Radchenko
2024-04-13 16:08   ` Morgan Smith
2024-04-13 16:48     ` Ihor Radchenko
2024-04-13 17:46       ` Morgan Smith
2024-06-18  7:39         ` Ihor Radchenko
2024-06-19 14:57           ` Morgan Smith
2024-06-19 15:46             ` Ihor Radchenko
2024-06-19 18:24               ` Morgan Smith
2024-06-20  9:07                 ` Ihor Radchenko [this message]
2024-06-24 12:09                   ` Parse malformed clocklines (was: Re: [PATCH] lisp/org-clock.el (org-clock-sum): Rewrite regex using rx) Morgan Smith
2024-06-26  9:02                     ` Ihor Radchenko
2024-04-14 12:53       ` [PATCH] lisp/org-clock.el (org-clock-sum): Rewrite regex using rx Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h6do7zj6.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=morgan.j.smith@outlook.com \
    --cc=sanelz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.