From: Ihor Radchenko <yantar92@posteo.net>
To: Felipe Balbi <balbi@kernel.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: org-habit and hourly repeats
Date: Thu, 19 Jan 2023 10:48:16 +0000 [thread overview]
Message-ID: <87o7qu4x73.fsf@localhost> (raw)
In-Reply-To: <87ilh4mjnt.fsf@balbi.sh>
Felipe Balbi <balbi@kernel.org> writes:
> I'm trying to start using `org-habit' but I noticed that hourly repeats
> are not properly parsed by `org-habit-duration-to-days', however that's
> a valid use case --- e.g. drinking water, medicine schedule,
> physiotherapy sessions during the day, periodically practicing a new
> language. For example, here's an easy TODO item that reproduces the
> problem:
Habits occurring multiple times a day are not properly supported in
general. See https://list.orgmode.org/orgmode/87leplsggg.fsf@localhost/
> It appears that a simple solution would be modify
> `org-habit-duration-to-days' to accept the `h' suffix and set it to a
> fraction of a day, something like:
>
> 8< -------------------- cut here --------------------
>
> (defun org-habit-duration-to-days (ts)
> (if (string-match "\\([0-9]+\\)\\([hdwmy]\\)" ts)
> ;; lead time is specified.
> (floor (* (string-to-number (match-string 1 ts))
> (cdr (assoc (match-string 2 ts)
> '(("h" . 0.042) ("d" . 1)
> ("w" . 7) ("m" . 30.4)
> ("y" . 365.25))))))
> (error "Invalid duration string: %s" ts)))
>
> 8< -------------------- cut here --------------------
>
> Would something like this be an acceptable solution?
I afraid that things are not that simple.
--
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:[~2023-01-19 10:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-18 6:38 org-habit and hourly repeats Felipe Balbi
2023-01-19 10:48 ` Ihor Radchenko [this message]
2023-01-19 10:58 ` Felipe Balbi
2023-01-19 11:04 ` Ihor Radchenko
2023-01-19 11:06 ` Felipe Balbi
2023-01-19 11:13 ` 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=87o7qu4x73.fsf@localhost \
--to=yantar92@posteo.net \
--cc=balbi@kernel.org \
--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 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).