From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id KCNdLwT7x2OnBQAAbAwnHQ (envelope-from ) for ; Wed, 18 Jan 2023 14:58:28 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id WN7+LgT7x2NwQgAAauVa8A (envelope-from ) for ; Wed, 18 Jan 2023 14:58:28 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9B37038D4E for ; Wed, 18 Jan 2023 14:58:28 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pI8wN-0004pN-KC; Wed, 18 Jan 2023 08:57:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pI269-0007o0-EY for emacs-orgmode@gnu.org; Wed, 18 Jan 2023 01:39:01 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pI267-0007wv-CF for emacs-orgmode@gnu.org; Wed, 18 Jan 2023 01:39:01 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7F489616C4 for ; Wed, 18 Jan 2023 06:38:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57595C433EF for ; Wed, 18 Jan 2023 06:38:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674023929; bh=xcCuBzVgfPLC6xMr7YO2aSALH0mAg5JFBddoh2C2gVE=; h=From:To:Subject:Date:From; b=NMyTXDrcL4NDt1GJwVNZqE+Yqd7ZS+GQsrPWBWZx7iS4Fi8ye+TpH0kBWdLUf2Zqt gZayNxpbA2DSQfw8L7aImg6RMepMRUg5Eg0vMGSDo9yrMlKiaDnBL/dLKKJI48H0VR gTW6hmNFwQtfqyySb1fmoBlWf4ZXn3jAhe8LcBQj6IV4mKLteGeR/AbsJOuUBP/6/S t3UgeRyMkdLM+awsfkxF7K+00O61n2LDz67y8ayQDB5PhrOyApZAgQ3ESbIaDj5scC zCL3nDxdpngyF+XE+o39S0lCgtHc2Pow4MJ2FV0jJqUMBkvf9sCF9SrWhQTQnkSqIi DC9WUSecVlYIw== From: Felipe Balbi To: emacs-orgmode@gnu.org Subject: org-habit and hourly repeats Date: Wed, 18 Jan 2023 08:38:46 +0200 Message-ID: <87ilh4mjnt.fsf@balbi.sh> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=139.178.84.217; envelope-from=balbi@kernel.org; helo=dfw.source.kernel.org X-Spam_score_int: -70 X-Spam_score: -7.1 X-Spam_bar: ------- X-Spam_report: (-7.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 18 Jan 2023 08:57:21 -0500 X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1674050308; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=4SFMaLOSttPQJJ72v9w/CGI1fhaMscN+8f5ZcDl3WqA=; b=vDmzrjjW0krjuMR292SUNkXnUJdJJeVwxYwv05gGn2ic+BNo2hp4QQRyrIVyA+MeYZANeB Rtpxg632Jac1d6CKsiY5qwMVQQjOMCh8ccIKVX4epB/1VafQB1oJVW5rIPtoHhLsY/QdfZ ZmPUR0N6/BJB5wxvLSdnoN+dgKrBawkfJ7CtS+Z5jEqbqsaBd3cq3SsHwwUJtoQHUHhF8k 9ho9oQJStngI/qLJ5vEFkfD9jT5uwTNXzKoW8Wrn6vGtl9jTFvLxXngbz5kWOrD6kUif76 B8ExZh95qMvo/6G5rmwWqZOoLA6gIO1HuoBKgznGmbLSMLuPnqtNczFEU6A0zg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NMyTXDrc; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1674050308; a=rsa-sha256; cv=none; b=FkC0AJGD9W0tnjR7XBqcVNW3TdB77tZejzdd16JyOd5aJgWvl7A7T2j6awYeHga8i1ITSs RnmjhcFTgoloQY4roM2wxgSm2YzP7FyuVCJvvao+6OQucWtQuXw5Bgd8BulAgIh/mpvU8n bqWs3RHyYfbgMhXDWxc5stL1NAnenwQuNful7Z+4G87QPsw+KLACF+64df0XNzHl43BWHI S5J62oy8zxCQwA1XvSkdGCXo8FsNtZP07/hWRMyyi/6PXkeUSCdYKHXp+YOUL6Nt1eoX2h X/Z2Z7lV1zHhd9XcTgXZn2quEr76tf9hng8hiatnLQsfzr0Qs50RDs4kyr/Vyg== X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -10.58 X-Spam-Score: -10.58 X-Migadu-Queue-Id: 9B37038D4E Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NMyTXDrc; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-TUID: DA/05PlwF6pp Hi, 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: 8< -------------------- cut here -------------------- * TODO Foo SCHEDULED: <2023-01-18 Wed 11:00 .+8h> :PROPERTIES: :STYLE: habit :END: 8< -------------------- cut here -------------------- 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? -- balbi