Hi, On Thu, Jan 19, 2023 at 12:47 PM Ihor Radchenko <yanta...@posteo.net> wrote: > > Felipe Balbi <ba...@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/
That's very interesting, because repeated tasks clearly mention hourly repeats: https://orgmode.org/manual/Repeated-tasks.html "You can use yearly, monthly, weekly, daily and hourly repeat cookies by using the ‘y’, ‘m’, ‘w’, ‘d’ and ‘h’ letters." > > > 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. Do you mind expanding on this? Just generally curious, really. -- balbi