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 UNyBEEC+RmOi1wAAbAwnHQ (envelope-from ) for ; Wed, 12 Oct 2022 15:16:48 +0200 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 WMpoEEC+RmOMdwAAauVa8A (envelope-from ) for ; Wed, 12 Oct 2022 15:16:48 +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 E4AA3251D6 for ; Wed, 12 Oct 2022 15:16:47 +0200 (CEST) Received: from localhost ([::1]:42510 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oibbK-0004WG-Lq for larch@yhetil.org; Wed, 12 Oct 2022 09:16:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38878) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oibaL-0004VM-KZ for emacs-orgmode@gnu.org; Wed, 12 Oct 2022 09:15:47 -0400 Received: from mail-co1nam11olkn2098.outbound.protection.outlook.com ([40.92.18.98]:21440 helo=NAM11-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oibaJ-0000J4-I8 for emacs-orgmode@gnu.org; Wed, 12 Oct 2022 09:15:45 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EjzsT1DwOxvSdtYXPeXCZqXpbzeNZjXMOqtp9XcI2UPSWYw0oKVht1XFQ2HT1BFZWrUgfelQ58wFIvqnw25jNrOZQNPocSLMlBGhY6/fDgMQQks9OwkCiMnOaDibl5BxRiKYAIbf2tFGazPLcmMSarIZXX+qu1sDYeTS4pZjJTswb5xDKes/c6T1B/0s5vIbFrojQhldWPZNxyFQfp1CjWXREpRMLASl5mmtU0RtfBsf/2Hme7Yay1rZapLnbC2Rc3U0ziq5OOHCIEi6SwYuu/nEZDxEvWBE5zMPnlSW7XJBM18SvTEPRxfQgGcyneD6wvvF3UPBMHYSkFNf3gXxTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=34VjvQ6LY+1oX9OpkP9Zxv/UWnyofxHXM+pBfUAeelg=; b=MYC0N28l9W7maXGQ5EFvuKOm/BSP9unsFgjnWlOpAlxV5wu2ZTzZd14m5hYMKXujk2CkSu87M5Yl2ZoLBYOirIMkilUcmLbXd9yoY1/28+VYtKjQ+gQTec6ADcZTVn7ATf1qYFTHINiy155Ubem/TfHZlplo57nAdGl54N5CfbesDcBLzmOfqEwTnJygLCkSEEzAj/pqGupnIAjbl9zso6kghbwz91OWTGDAP7lOkG31rS6p5uEzqAPBuPJlIn6dKs6gHLnT07TzUN8qGbp3sGNUcY/jCTujJ7BDPXnGWNVQsI/iSC9gdC8AYddqfO/YJLyu9bLNGMxHVaVpTmJm+A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=34VjvQ6LY+1oX9OpkP9Zxv/UWnyofxHXM+pBfUAeelg=; b=OjLThLhT49EqqIH+tAxuHRinvG3m5V3uPUFM8MdsLeT6K3NNAgQL1iQVW3901JEvCYDeWphVcWm4zpXaPeTMXAGae0dq2KsKLnVzxDQ6TCxEcdar1002hYW/W4ua9TPUQ0qoiCO7wYkIyI0R0wpUqKSzzkPPFK2dC6/PSioCOrm08kPhGiDo6f3TIWp66L/cBuWQ2lpeOnvqWML0eh9zNXWG6khelow8tQ76EWD//SKuEZqOtLrcUZLvTRd+OC7z2IDbJK0WDtEtDs8XWnWx33X613oLVoZZb4GOVwonXV2m79usP0PWPZhpBLHDeXrs/wd+eb4uuO9pG9oGjWH1Yg== Received: from DM5PR03MB3163.namprd03.prod.outlook.com (2603:10b6:4:40::24) by MW4PR03MB6947.namprd03.prod.outlook.com (2603:10b6:303:1be::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15; Wed, 12 Oct 2022 13:15:38 +0000 Received: from DM5PR03MB3163.namprd03.prod.outlook.com ([fe80::6554:f431:b243:a53b]) by DM5PR03MB3163.namprd03.prod.outlook.com ([fe80::6554:f431:b243:a53b%3]) with mapi id 15.20.5709.015; Wed, 12 Oct 2022 13:15:38 +0000 From: Morgan Smith To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] Org Habit fix + new feature In-Reply-To: <87leplsggg.fsf@localhost> (Ihor Radchenko's message of "Wed, 12 Oct 2022 14:29:03 +0800") References: <87leplsggg.fsf@localhost> Date: Wed, 12 Oct 2022 09:15:36 -0400 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Content-Type: text/plain X-TMN: [5/pnqpVUJaDl3ukxbjEBMK1j4rR30WFR] X-ClientProxiedBy: YT1PR01CA0135.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:2f::14) To DM5PR03MB3163.namprd03.prod.outlook.com (2603:10b6:4:40::24) X-Microsoft-Original-Message-ID: <87pmextc7b.fsf@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR03MB3163:EE_|MW4PR03MB6947:EE_ X-MS-Office365-Filtering-Correlation-Id: 5b6a43f4-2a48-464f-7cff-08daac53dab8 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 52oV/isnYWiQMYXL/F314tXmU9cMKKKR1owA7FEDtH8p1CNw+wPA+6N0UXR2LzPWQzNHDGg2lWcoAY0lUJPQcXxu/N5sk52LO9st5py0+1JHP2BID4gXgj+GxZjGIv0bU2RbOGqYinYG6yriKpM/UuBnaDjg73473fDsn2aJGPJy2RB+iS50dcQYXlOTx6pbGQSLmfxg5YmTVs78rfX861LfxflKuz/TA44gojs1VgnCZxar65Dn2x/h4hYJkGaozk7Pocz9ZSatNlhTxi6vPVoSQAS7RLAlWjKbRtaQXgg7SB1owQAnbv152ia9Y/KboiBtoBBKd8UYmBnBVeg5hgnGVdIlY/L80Lo9F0lSZ/T7H+TRh1h6jjkqZGApDWpFpVisSqxWCZULTTdGRv0HFllIKl2j29tqJBv6Este9XU+yWHUD+gH0NEQdCeyJV95FrVnK1NzDO73KFNZVrkVZgc2F1tWGElNcuZ1+LygMjoO8ozSfBhEHUqNi8+ekE1/FqOiMwtXROpsgJqx1IQAweuAcWC8ygrl/BttTDVbFU039gnpjrpYq0lRXDwblbIq0V4JTZmZf8nRD+pTueG4X2l1PznqDRj+FmvLhChZTPZEiynnLY6nTfncwbOgy+TBYP2q0aNnuKcYNL89CON97n8Ooy/Be8pwTLjA4ebvvTxDOM1+AeXX4cQwMFvu9nuF X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?End9Gtig9TleEXdVRHUvWB7U3nrb/a/fVn/xoi+kW/ZfsnDHY4qvpJETl8b+?= =?us-ascii?Q?I3qpRrA2urrLPSbB24s0KBhN8LZIPsyu7SpsBSJW1ey/cz7IHEc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0uOCQViLxmP3CoRMiblJQnWP8ZllXTNLgewkSN?= =?us-ascii?Q?TaJljviXqsx40izVub5USrJCJvKqBYnJRWEY7flpUV349ifW3JSf4xb1RdxH?= =?us-ascii?Q?kJr/VCecZ7QyIQy/dDo2SZDXhOPV/fFHxGNlQdAYukqhq3284w5rNvUVgFH9?= =?us-ascii?Q?zrjozzhwUxXVMllxEhl7faeTFVZoW+DrfdHo/unUZA5Knjb127EXw8o5wh02?= =?us-ascii?Q?gaXZR1kFtXe9QOx4FdR6IdJDY7bgj5KVpK93Sktm5zkZCqM1MD2kXVoaKaUb?= =?us-ascii?Q?vysIg/zTrcquSrSvc8EhKJkMKoTKNfElxm9yCbbBS4AwQQW3AGbOKpZ6sGXZ?= =?us-ascii?Q?o6k=3D?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b6a43f4-2a48-464f-7cff-08daac53dab8 X-MS-Exchange-CrossTenant-AuthSource: DM5PR03MB3163.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2022 13:15:38.2664 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR03MB6947 Received-SPF: pass client-ip=40.92.18.98; envelope-from=Morgan.J.Smith@outlook.com; helo=NAM11-CO1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-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=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1665580608; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=34VjvQ6LY+1oX9OpkP9Zxv/UWnyofxHXM+pBfUAeelg=; b=H1voZMR9HaXaSfJf38+gZt52xf4KNiZY/OKlkGX0HOKThKELcwEdCMOwghZtuV1th4dxuO 0h9or6X20qC9TE9qNhB5ejwTR9kDzIP39bacIt+KNMB2RsLY8bLpgbmYPCFBgKCBebbUNY 5MMAv9Uq44mIMWQa/rJTzCzHjrc+EIdeshW+BF3WpVyJEsPGPGrYXBROLJOUWZktSzfBjm wShUZSQ5Tt4eoZpmeHeXhRsm+iBt1ArCe2htbriC49vO2N3iMws/ychqefbkIo26K5jo0F Ju/eW1G2xiIDzYrHH5NG6Fhi3bKzg8G/TpDCEWc0ReJ3E6fkqRdDsjlZ1aZ+iw== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1665580608; a=rsa-sha256; cv=pass; b=FPI5TMFOl06aFZysa4OdGfS63VgPjyETW7PtddlZDFMl/84Uz+7ShMQCYf/sQ1DB0Q2j1d haJfCOjg36nHlNHDCU5v6u0VVICDxeocvgvlw2surofokS+ukCj3UqVcfpwrdCr17w8zgT hVQ18jubeWSooLq0OCbl99WYH7upO5FamtQhiPGLJFPQ5r4yepQJCns7nlhdi6Ilzw9sF1 EXaov8xwP2M0uotL+ccQ6vG/tX6tMFq+3MQcWhyp3ONvSVH5VIsUie9+Gwy8YJZvwvjh25 kWIuoh2CE5Cj1UJt3vhtG1zrEDm/E4GWhIWklcecFXyZikqHshHlXMb2hAxQjg== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=outlook.com header.s=selector1 header.b=OjLThLhT; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=outlook.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: -10.20 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=outlook.com header.s=selector1 header.b=OjLThLhT; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=outlook.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: E4AA3251D6 X-Spam-Score: -10.20 X-Migadu-Scanner: scn0.migadu.com X-TUID: AGhqYcd6s9E4 Ihor Radchenko writes: > > 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. > Oh that's a good point. I'll have to go back through the code and see if that's an issue. As for your comments on the first patch, let me explain where the current logic falls short. Imagine you complete a habit multiple times in a day because you're using org wrong (yep this also violates that previous thing that I gotta look into but let's not worry about that for now). The current logic simply looks at the previous '(+ org-habit-preceding-days org-habit-following-days)' log records which by default would be 28. First of all, why are we looking into the future at all? I don't think the habits graph currently supports looking at it from the perspective of a different day and I think marking things as complete in the future is pretty odd. Second of all, if we use org wrong, then we will start loosing days at the beginning of the graph if we have more then 28 log records in our period. Now my patch calculates the first day of the graph and simply looks at all log records before that date. This is more robust if we want to use org wrong. Also it's more intuitive I think. In many cases I think it will also be a performance boost since then we likely won't loop the full 28 times. Furthermore, this method would support looking at the habits graph from the perspective of a different day (which blindly looping 28 times does not). This patch does not do a good job at adding support for repetitions. The graph and logic still works in days, not repetitions. It simply makes the current code more robust. > Also, (org-today) does not consider org-extend-today-until. (see > org-habit-insert-consistency-graphs). Thanks for catching that! > > This logic will fail for non-default combinations of org-log-into-drawer > + org-clock-into-drawer + org-log-states-order-reversed. Well shoot. That's a bummer. So why are we using a regex here anyways? It feels not super robust. Don't we have an AST we could use instead? Also even if we do want to use regex, pulling out log records and clock records seems like a pretty common thing to do that should be in a core library function right? Thanks for the review! I appreciate your feedback Morgan