From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.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 GCeiCqBfRmNjQgAAbAwnHQ (envelope-from ) for ; Wed, 12 Oct 2022 08:33:04 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id GE/LCaBfRmO0LgAAG6o9tA (envelope-from ) for ; Wed, 12 Oct 2022 08:33:04 +0200 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 E03E8186FD for ; Wed, 12 Oct 2022 08:33:03 +0200 (CEST) Received: from localhost ([::1]:44806 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oiVIc-0003pB-Ry for larch@yhetil.org; Wed, 12 Oct 2022 02:33:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39514) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiVE3-00034J-3s for emacs-orgmode@gnu.org; Wed, 12 Oct 2022 02:28:19 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:52755) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oiVE1-0002EF-34 for emacs-orgmode@gnu.org; Wed, 12 Oct 2022 02:28:18 -0400 Received: by mail-pj1-x102a.google.com with SMTP id pq16so14458938pjb.2 for ; Tue, 11 Oct 2022 23:28:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=DGUq1TpNsnxyMm52PtBeT/S+G/A6u3wM8ydW3pvZHDw=; b=W4IaDAu+338VeX8OZeZ5Qpo9qwxwTjgOYHcJp/3uHRYtOValYKTvMhXMtHz9wHSb/1 yWik4KJsqfstAQI6pUjcN9BcmezwngcoU2Yi62B34YssotYTDreKgxBta/J7TfYvS9us hkQrtUDF/rB08mKizLCvrApHEFg0Y4O6A4uwMeTpdXYMy4bRivnziWUgnlWPVDd+ogWr L1kbSade3PVL21ywWKw/sNW7DCDCqL6RWQ9hH94+2xmkxwuB5a2NTFQwJmCf/Q2JSR0l krfH3GhwPut4sVWLJ4jj2TDC15WZMZuI7HCUIqVLRc2wTP5mTO+15a/SjDUlUTJlP/gV VcZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DGUq1TpNsnxyMm52PtBeT/S+G/A6u3wM8ydW3pvZHDw=; b=Se1vwEL0ptuoSMmNwcpLj4n2YkLnirpcsKnQ6DafIDGDk2nzdDziW8ojUDcgKUyo8v NMxmlLtM+U8VTN4DAhNSYDS4PMzEPgQfD0SWaVBgnfDHthwuSI9Snfkm42HS/vs4IDMK XPSmuQsHJpkscms5fFA9//Mf7eCkj3hNbDrtfJxqf8egdj3gh3UdiFFVzCLerXPsBSXB L6pomFSsbRL5liD63JCGd/0uIWzAiJbCAvrFOaPibSDOuAlqDrL6ytbrU0yC11I37i3S XVVfUJmYe+Vl32KIX/bpCKMxr2aSs7FGbdNOOtc+dRDHy43ETDddeGqG4xslqTeCYkEz BfzQ== X-Gm-Message-State: ACrzQf1qJxQ+CD7ytEq/7RkS0witxbx7dIdy9wFDuUS+Gwdplycp9Nx5 BauPEmvItPjjcTbR7tnAj0A= X-Google-Smtp-Source: AMsMyM6qNkVG5MSF552W1rX6Kril2CPV0efBALOQrsSJWYvxSGMABAlCxRSe5lO9Q2Esz15WJ4rtaA== X-Received: by 2002:a17:90b:2812:b0:20d:7a3b:df3e with SMTP id qb18-20020a17090b281200b0020d7a3bdf3emr3307115pjb.169.1665556095478; Tue, 11 Oct 2022 23:28:15 -0700 (PDT) Received: from localhost ([2409:8970:af2:32f:6c23:3ad5:f37d:541b]) by smtp.gmail.com with ESMTPSA id q8-20020a170902a3c800b00179eb1576bbsm9640318plb.190.2022.10.11.23.28.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Oct 2022 23:28:14 -0700 (PDT) From: Ihor Radchenko To: Morgan Smith Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] Org Habit fix + new feature In-Reply-To: References: Date: Wed, 12 Oct 2022 14:29:03 +0800 Message-ID: <87leplsggg.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=yantar92@gmail.com; helo=mail-pj1-x102a.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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" 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=1665556383; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=DGUq1TpNsnxyMm52PtBeT/S+G/A6u3wM8ydW3pvZHDw=; b=BRPz3VO1HAjZs+2Vpa0BXkXx3GQH6KzwWTJ46wQdLWRoOFunPd0c0IDo+igf3zuJQDPjwc 2kw9AqYu515ijo7/BYZHsGwwQ44iUgfI1gLr+u2PVM2SizorJCyFS58Z6cLu0I9bIjOQhk VVSScPrb6B+zrTNdHSPTlj/ajhH7fFXC0fqXoJIt9+2eVtzB+9sufMEb9mAYN/2mT9R/p1 94syEIRdDvREcCRescpVAz4/ZAPCpUMx5Um29K665D9APMGAayTkrqwjIo38eNmmKZBNfP pOAwiydSwHMBDv9XChUWBzGPOqGPWCABwnazKDJyNS9K/Qy4AZEJ2pvZ7dU6yQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1665556383; a=rsa-sha256; cv=none; b=E/7/4fKwdwCFAkSbQHUbgNh4AXhXs8qi3ZR4NRoufiadlTxMTvO4fw6453fMFP0Hw4CBTg Vq67V4syRvjyIO6oGBLgTCWS06ipDBR0I6ZH0/BF6h/i7eFXcOCfgNqUOw4p7gxrtCxn73 V2AkE+kr4qG84nBAltjNxj4HZHrskp6uPcg4MKxOlka7uw5XGP8Cg7bdX6UNUzu8GF6F70 nbctvGwzHLO6icL9rz11NSoOZYUy/UDjbOuWivewfWrVH633tc78H+pauQLBqlB2SIWuUs R5esL1XDzG9nZgkgwNDRIDU7IyTtkOaAThpdH4uJ53pskXbIHurSjPdGLlTBAw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=W4IaDAu+; dmarc=pass (policy=none) header.from=gmail.com; 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-Migadu-Spam-Score: -3.40 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=W4IaDAu+; dmarc=pass (policy=none) header.from=gmail.com; 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-Migadu-Queue-Id: E03E8186FD X-Spam-Score: -3.40 X-Migadu-Scanner: scn0.migadu.com X-TUID: KvV0q464aNIU Morgan Smith 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.=20=20 > From cc16dd6a8c59312a75b8e25669a7e4eb3d9f9ef4 Mon Sep 17 00:00:00 2001 > From: Morgan Smith > 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=E2=80=99s really useful about habits is that they are displayed= along with a consistency graph, to show how consistent you=E2=80=99ve 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-da= ys)) > + (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 th= is 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. --=20 Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at