From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id iK10GbycGmbxOgAA62LTzQ:P1 (envelope-from ) for ; Sat, 13 Apr 2024 16:54:52 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id iK10GbycGmbxOgAA62LTzQ (envelope-from ) for ; Sat, 13 Apr 2024 16:54:52 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=T6Npj0vG; 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"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1713020092; 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=e8S2cwAySN+ytMhpAInTctM7X/ahclNfbSB4qhENINc=; b=sQhD4F7BD+x5ybG/Is1YL41mJsyUNKBQ4RwcwM1Zgm945dosPnEXPMBXWoxgdj4qFegfTZ +FdmI76sJB5hc8PkkV/RRfBfePyjOtJ2iJHuFXinBy7HXeVy7WqIPEgixB+wIDFtFrO6rG yFt9p//HDX9GRvjAxiZpPvhsnDk6eWYDqi0Noywkbq545h6S9X21oop0+iI7CElWfMrvWv a9tGn4UsDlACigLZpiUNb1s4leofLuYoTcuR+ggpI6ji1yRU3pftHxzITFgqO2VdGx3M3p 2X24pz9tPJu+w4qIA1b1kLmQfBOTJSChf5ZgO5Dmp0hdCwyWxY5yujVRX6BRqw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1713020092; a=rsa-sha256; cv=none; b=Gry1qBKhvaAQlFDmHIp8tPvruC+ccjP2uG31JEQjPd13mssyNzVdrsr8Pl5rxmhTv6yJ1y 9UFvnrXLNvWKPQDML/D8wf8ULlTWfzo5am39YOnYFQ8zc+MYlMkR/0g38PCq+i9DaFPg9l mE+2NAw6Vwly9uZki+HI+HEzkgVyUWz+ywb2/GzxlZ16YG2JoTkBX+lmLpnI/YNS8jYZc9 TtHFQxf0pYhlkB8BzCwZCVU2saPPoQZj2rt6czsq+1AkNH8SVt1G1oSw9dsQRPdoWBuIOC MKJUoS83LUyZKcuGmdpiDwGR8e7zogCMTMfFG0Tf9wDDNSZYloVy98K5lMWAUw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=T6Npj0vG; 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"; dmarc=pass (policy=none) header.from=posteo.net 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 0071167B5E for ; Sat, 13 Apr 2024 16:54:52 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rvegd-0003ue-8Y; Sat, 13 Apr 2024 10:49:00 -0400 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 1rvegb-0003tS-65 for emacs-orgmode@gnu.org; Sat, 13 Apr 2024 10:48:57 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rvegY-0006Fr-La for emacs-orgmode@gnu.org; Sat, 13 Apr 2024 10:48:56 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id DDB05240103 for ; Sat, 13 Apr 2024 16:48:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1713019731; bh=0py603ITrcbi2jv6uPfTx1xpAiPkpfY59+0bXgOL8K0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=T6Npj0vGFqfYxqU/4tGfC0gqG2P6e8O88IZ5ej8SIkDBxk20Rz3mZeAjje/7BNYO2 NI9F3nLGaAu7KPcE88navnjYKRGay68+r1HFbD0h99Uho5YjsJEKHTe6WfTm33BvSb uUhphnN4445Xz5yQ0ospPPkM5WKEhtgb7oEZ5zpKBEthNVMjaZivRY4ckKzFS8CxSa k5mLNAwoOrwzOjXmh59qNighSJEF9jfQF5PUC66r/izINlUsPj7C304BFQna6tQpbQ UgSiTenusYe8qA+6GSPea679M7avB8nRSTeIe1SnRIeX4SLUUlJJ8hWb6meoiD8Mnh txjHVdILGD1wQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4VGxC66jXSz6twm; Sat, 13 Apr 2024 16:48:50 +0200 (CEST) From: Ihor Radchenko To: Morgan Smith Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] lisp/org-clock.el (org-clock-sum): Rewrite regex using rx In-Reply-To: References: Date: Sat, 13 Apr 2024 14:49:21 +0000 Message-ID: <87r0f9b9n2.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -7.81 X-Spam-Score: -7.81 X-Migadu-Queue-Id: 0071167B5E X-Migadu-Scanner: mx13.migadu.com X-TUID: Dlo9RW7EsgQJ Morgan Smith writes: > See two attached patches. All tests pass on my computer. > > Every once in a while I feel obligated to go back to org-clock-sum to > try and optimize it. I have a file with 8 clocktables in it and it > takes forever to update. This time I decided instead of trying to > optimize, I'm just going to try and understand. > > The regex has been altered slightly. > > 1. Instead of using "[ \t]", I decided to use [[:blank:]]. No real > reason. I just think it's easier to read and maybe slightly more > correct? > > 2. For the timestamps, instead of ".*?" (using a non-greedy ".*") I > decided to use "[^]]*" (accept everything except "]"). I did this simply > because I'm not used to using non-greedy regex's. Maybe this way > performs better? I didn't test that. > > 3. I used the variable `org-outline-regexp' but that doesn't actually > change the regex. Thanks for the patch! I think that a better approach would be re-using the parser constant `org-element-clock-line-re'. > * testing/lisp/test-org-clock.el (test-org-clock/clocktable/insert): > Add a clock time that does not include timestamps. > ... > - > - (goto-line 2) > + (insert (org-test-clock-create-clock ". 1:00" ". 2:00") > + "CLOCK: => 1:00\n") This is not a valid clock format. Matching such lines is a bug. See https://list.orgmode.org/orgmode/87wpkkhafc.fsf@saiph.selenimh/ -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at