From: Ihor Radchenko <yantar92@gmail.com>
To: Morgan Smith <Morgan.J.Smith@outlook.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Org Habit fix + new feature
Date: Wed, 12 Oct 2022 14:29:03 +0800 [thread overview]
Message-ID: <87leplsggg.fsf@localhost> (raw)
In-Reply-To: <DM5PR03MB316387549A971AD4036E59EDC5239@DM5PR03MB3163.namprd03.prod.outlook.com>
Morgan Smith <Morgan.J.Smith@outlook.com> writes:
> The second patch allows a habit to be considered done if time was logged
> to it. Imagine you have an org habit like shaving. Chances are, if you
> spend time doing it, it's done. I like to set LOGGING to nil for these
> kinds of habits since it's redundant to have all those state changes
> that tell me exactly what the logbook already tells me.
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.
> From cc16dd6a8c59312a75b8e25669a7e4eb3d9f9ef4 Mon Sep 17 00:00:00 2001
> From: Morgan Smith <Morgan.J.Smith@outlook.com>
> Date: Tue, 11 Oct 2022 11:44:26 -0400
> Subject: [PATCH 1/2] lisp/org-habit.el: Use time as a history cutoff point
>
> * lisp/org-habit.el (org-habit-parse-todo): Use time as a cutoff point
> instead of using a count.
>
> This allows viewing the full history of habits that are completed
> multiple times a day. Previously we would miss some days and show an
> incorrect history
There is currently nothing in the manual or function docstring that
suggest supporting habits that are repeated multiple times a day.
5.3.3 Tracking your habits section of the manual says:
What’s really useful about habits is that they are displayed along
with a consistency graph, to show how consistent you’ve been at getting
that task done in the past. This graph shows every day that the task
was done over the past three weeks, with colors for each day. The
colors used are:
Explicitly saying that each symbol in the graph corresponds to a single
day.
Further, org-habit-preceding-days and org-habit-following-days are
explicitly talking about days, not repetitions.
> - (let* ((maxdays (+ org-habit-preceding-days org-habit-following-days))
> + (let* ((firstday (- (org-today) org-habit-preceding-days))
What about org-habit-following-days? Why did you throw it away?
Also, (org-today) does not consider org-extend-today-until. (see
org-habit-insert-consistency-graphs).
> (re (format
> - "^[ \t]*-[ \t]+\\(?:State \"%s\".*%s%s\\)"
> + "^[ \t]*-[ \t]+\\(?:State \"%s\".*%s%s\\)%s"
> (regexp-opt org-done-keywords)
> org-ts-regexp-inactive
> (let ((value (cdr (assq 'done org-log-note-headings))))
> @@ -233,15 +238,20 @@ This list represents a \"habit\" for the rest of this module."
> ("%t" . ,org-ts-regexp-inactive)
> ("%T" . ,org-ts-regexp)
> ("%u" . ".*?")
> - ("%U" . ".*?")))))))))
> + ("%U" . ".*?"))))))
> + (if org-habit-clock-completes-habit
> + (concat
> + "\\|^" org-clock-string ".*\\]--\\(\\[[^]]+\\]\\)")
> + ""))))
This logic will fail for non-default combinations of org-log-into-drawer
+ org-clock-into-drawer + org-log-states-order-reversed.
--
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>
next prev parent reply other threads:[~2022-10-12 6:33 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 [this message]
2022-10-12 13:15 ` Morgan Smith
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87leplsggg.fsf@localhost \
--to=yantar92@gmail.com \
--cc=Morgan.J.Smith@outlook.com \
--cc=emacs-orgmode@gnu.org \
/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.