emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Guido Stevens <guido.stevens@cosent.net>
Cc: emacs-orgmode@gnu.org
Subject: [BUG] Regression: org-duration fails to support duration ranges since Org 9.0.6 (was: support range durations)
Date: Sun, 22 Sep 2024 07:56:43 +0000	[thread overview]
Message-ID: <87ed5cruis.fsf@localhost> (raw)
In-Reply-To: <4b0d8deb-585e-4dd5-a332-72de057a3247@cosent.net>

Guido Stevens <guido.stevens@cosent.net> writes:

>> May you please provide more details on how to trigger the error?
>
> Sure. I'm providing the Doom keybindings for the actions I'm taking.
>
> 1. Abbreviated snippet from my Doom config:
>
> (use-package! org
>    :defer t
>    (setq!
>     org-global-properties
>     `(("Effort_ALL" . "0 0.5d 0.5d-1d 1d 1d-2d"))))
>
> 2. Set estimate "1d-2d" on a task (C-c C-x e)

At this point, using emacs -Q, I am getting

Debugger entered--Lisp error: (error "Invalid duration format: \"1d-2d\"")
  error("Invalid duration format: %S" "1d-2d")

In other words, such ranges are not supported in Effort property.

I am not sure what Doom does so that you are not getting that error.

> I'm puzzled though, because I did not come up with this feature. It's 
> genuinely useful and it appears to have worked in the past.
> https://lists.gnu.org/archive/html/emacs-orgmode/2014-12/msg00435.html

I bisected the problem back to the initial introduction of org-duration
library. It simply does not support duration ranges.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=7e8cf5f4c202f51231d444f41735a4db06cb7052

The right thing appears to be implementing such support in org-duration.
However, it is not at all trivial, as the duration API in
org-duration.el is designed without ranges in mind.

> Maybe sorting agenda views by effort was not active at that stage: I 
> suspect that is what is triggering the error. Which points to a 
> potential solution (and also to a potential speed optimization): even 
> when I am not sorting on effort at all, this error is thrown, so why is 
> org-duration-to-minutes even called at all in the agenda view? Is there 
> a way to disable that?
>
> I.e. even when I simplify my sorting strategy to:
> ...
> org-duration-to-minutes is called and throws an error. Why is it even 
> called?

Agenda converts and stores duration in minutes as a part of calculating
metadata for agenda items. Your duration format cannot be converted to
minutes, leading to the error you are seeing.

My current conclusion is that we unfortunately got a regression since
Org 9.0.6. And it is not very easy to fix it without implementing
range durations across the whole codebase.

One possible "fix" could be making org-duration ignore ending estimate
in the duration ranges, but that's not ideal.

This is a difficult bug to address.

As a workaround, I suggest using some other property for your effort
estimates. Then, est+ summary in column view will work without errors.

-- 
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-09-22  7:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-11 12:01 support range durations Guido Stevens
2024-09-15 12:02 ` Ihor Radchenko
2024-09-16  8:41   ` Guido Stevens
2024-09-22  7:56     ` Ihor Radchenko [this message]
2024-09-23 12:21       ` [BUG] Regression: org-duration fails to support duration ranges since Org 9.0.6 Guido Stevens

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=87ed5cruis.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=guido.stevens@cosent.net \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).