From 3c3d7abed25cafb2be1096ca079a0e8be907c644 Mon Sep 17 00:00:00 2001 From: Morgan Smith Date: Thu, 11 Apr 2024 12:23:21 -0400 Subject: [PATCH 1/2] lisp/org-clock.el (org-clock-sum): Rewrite regex using rx --- lisp/org-clock.el | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 65a54579a..5ef987ab8 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -2008,9 +2008,23 @@ each headline in the time range with point at the headline. Headlines for which HEADLINE-FILTER returns nil are excluded from the clock summation. PROPNAME lets you set a custom text property instead of :org-clock-minutes." (with-silent-modifications - (let* ((re (concat "^\\(\\*+\\)[ \t]\\|^[ \t]*" - org-clock-string - "[ \t]*\\(?:\\(\\[.*?\\]\\)-+\\(\\[.*?\\]\\)\\|=>[ \t]+\\([0-9]+\\):\\([0-9]+\\)\\)")) + (let* ((re (rx line-start + (or + (group (regexp org-outline-regexp)) + (seq (* blank) + (literal org-clock-string) + (* blank) + (or + (seq + (group "[" (* (not "]")) "]") + (+ "-") + (group "[" (* (not "]")) "]")) + (seq + "=>" + (+ blank) + (group (+ digit)) + ":" + (group (+ digit)))))))) (lmax 30) (ltimes (make-vector lmax 0)) (level 0) -- 2.41.0