From: Morgan Smith <Morgan.J.Smith@outlook.com>
To: Ihor Radchenko <yantar92@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Org Habit fix + new feature
Date: Wed, 12 Oct 2022 09:15:36 -0400 [thread overview]
Message-ID: <DM5PR03MB31638B7ED5E8143EF6635E89C5229@DM5PR03MB3163.namprd03.prod.outlook.com> (raw)
In-Reply-To: <87leplsggg.fsf@localhost> (Ihor Radchenko's message of "Wed, 12 Oct 2022 14:29:03 +0800")
Ihor Radchenko <yantar92@gmail.com> writes:
>
> I am not against such feature. However, using clocking will break an
> assumption that a single log record corresponds to a single habit
> completion. This assumption is implied across org-habit code.
>
Oh that's a good point. I'll have to go back through the code and see
if that's an issue.
As for your comments on the first patch, let me explain where the
current logic falls short. Imagine you complete a habit multiple times
in a day because you're using org wrong (yep this also violates that
previous thing that I gotta look into but let's not worry about that for
now). The current logic simply looks at the previous '(+
org-habit-preceding-days org-habit-following-days)' log records which by
default would be 28. First of all, why are we looking into the future
at all? I don't think the habits graph currently supports looking at it
from the perspective of a different day and I think marking things as
complete in the future is pretty odd. Second of all, if we use org
wrong, then we will start loosing days at the beginning of the graph if
we have more then 28 log records in our period.
Now my patch calculates the first day of the graph and simply looks at
all log records before that date. This is more robust if we want to use
org wrong. Also it's more intuitive I think. In many cases I think it
will also be a performance boost since then we likely won't loop the
full 28 times. Furthermore, this method would support looking at the
habits graph from the perspective of a different day (which blindly
looping 28 times does not).
This patch does not do a good job at adding support for repetitions.
The graph and logic still works in days, not repetitions. It simply
makes the current code more robust.
> Also, (org-today) does not consider org-extend-today-until. (see
> org-habit-insert-consistency-graphs).
Thanks for catching that!
>
> This logic will fail for non-default combinations of org-log-into-drawer
> + org-clock-into-drawer + org-log-states-order-reversed.
Well shoot. That's a bummer. So why are we using a regex here anyways?
It feels not super robust. Don't we have an AST we could use instead?
Also even if we do want to use regex, pulling out log records and clock
records seems like a pretty common thing to do that should be in a
core library function right?
Thanks for the review!
I appreciate your feedback
Morgan
next prev parent reply other threads:[~2022-10-12 13:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-11 16:39 [PATCH] Org Habit fix + new feature Morgan Smith
2022-10-11 20:22 ` Colin Baxter
2022-10-11 21:47 ` Morgan Smith
2022-10-12 6:08 ` Colin Baxter
2022-10-12 6:29 ` Ihor Radchenko
2022-10-12 13:15 ` Morgan Smith [this message]
2022-10-13 3:49 ` 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
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=DM5PR03MB31638B7ED5E8143EF6635E89C5229@DM5PR03MB3163.namprd03.prod.outlook.com \
--to=morgan.j.smith@outlook.com \
--cc=emacs-orgmode@gnu.org \
--cc=yantar92@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 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).