From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id cKTZDLnkF2anuQAA62LTzQ:P1 (envelope-from ) for ; Thu, 11 Apr 2024 15:25:13 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id cKTZDLnkF2anuQAA62LTzQ (envelope-from ) for ; Thu, 11 Apr 2024 15:25:13 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=OS6wSfg6; 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=1712841913; 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=K7Tj4vwuw/1KpkcOJgPc2dN0HjSHqD94ivTGFpo2tSs=; b=XITAAug81DOV0YG5RygNzjU2RLwyJUyOA9KZFzxo6mGPeKDVhZyC84C/gr0GE62Qiavc8C 2YA0mN+S5MTXLuGbf7SgqzLNwAHVP74UiK1LBMU41/dzcZzVy2+2CjyzV9mT5+7LfBhy/H djhSFeQJLJ3lXmwlFgvCWfn/26ey9c1DxCTCxwAs9d81fq7pWfNeKwGpAFIJSEWVb0hIbD 2gGM6xVcjStkUCZi9OeVzjXkuAMK0vNVf3sz10+3TMZX7hcd97v2R03BT12PwLzd31vZYv O1DsdFFWffygch55gnav791YzPIxaiCh0X5nUnA9AEC+WmRMhPhNzT22dyQy9g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1712841913; a=rsa-sha256; cv=none; b=Nd73DAL9GNHR+mba4P7uxXyCbJ85rFWnT47iSkxRko9Ju9SmOoC4zHmN+kBRrp2rKRuLSH 15xfufSeBIIq6sC0LJmDKRHKdYYeazzW0wGofbUf3lAKr13eQJlKZ+L8WVDzbk6/mb3lsJ GSXHHYHt52D8YYKnvWYAGK9/Eim0LqRVkSh5nb3EGQ3pMf2/a/9c+yec6qHlVc+PwEzF0o pMqOLe3zY/DY1WTL8tTL9USuyTG6ofBa2tKUknSPtYr2RrPegMFMFZOIYbxF/tPTCTMLPQ o69Hw1AQSUw2foGgZiDECum57TESFfah7H/47jiSxwM4d1VBHXrDQLzRBp2PbQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=OS6wSfg6; 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 0C7D61273F for ; Thu, 11 Apr 2024 15:25:13 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ruuPh-0000hL-Un; Thu, 11 Apr 2024 09:24:25 -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 1ruuPd-0000gl-BJ for emacs-orgmode@gnu.org; Thu, 11 Apr 2024 09:24:21 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ruuPa-0005hg-Ef for emacs-orgmode@gnu.org; Thu, 11 Apr 2024 09:24:20 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id ACF4124002A for ; Thu, 11 Apr 2024 15:24:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1712841855; bh=OLPAqRfxav58C/3rATRWR3ShrNoNRw4lEtwN2zZqsRg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=OS6wSfg68cpXeV/hTDmb1pO4l68BjIwDopF/qiSTUmoCjpNvpm6Z48LfBhK/5EPu4 /201wV+p4pGwEKI8LzK0KSCnwA+QAsdHzbTEmFJzXG8D8QJYo1L2EmTUyIcdnAPv6L FzdcQPWI82neSWxkkOC2Hgat3lHO6zbDhN7uu5vnGyR5aecH/Kxk9soLxd1gCC1cWm yf0N/2ABRIYG5EZaez/wci7xQ1mfO0Mkdj3K78mWOVRovNN9GzFH9Vslx91ZZg70Ps L8BeCDqQ/w+6h+yXqGfxE3NE4F6RUHv4xbm5kPUSQwyJj0nTiNns1I7iqOE6UfLDXp zSD25Acifr9Wg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4VFgQQ3lZCz6tn4; Thu, 11 Apr 2024 15:24:14 +0200 (CEST) From: Ihor Radchenko To: Morgan Smith Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] lisp/org-element.el: Add repeater-deadline support to org-element In-Reply-To: References: <87ttkht6jc.fsf@localhost> <87sezxo194.fsf@localhost> Date: Thu, 11 Apr 2024 13:24:40 +0000 Message-ID: <874jc8yquf.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.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_H3=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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -9.58 X-Spam-Score: -9.58 X-Migadu-Queue-Id: 0C7D61273F X-Migadu-Scanner: mx12.migadu.com X-TUID: O4Gur1mXP7u9 --=-=-= Content-Type: text/plain Morgan Smith writes: > See two patches attached again. All tests pass on my computer. Thanks! Applied, onto main, with amendments (see the attached diffs). https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=66e307b41 https://git.sr.ht/~bzg/worg/commit/f1486f42 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=amendments.diff diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 2b418cd3c..e61bd6988 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -516,7 +516,9 @@ and returns an appropriate timestamp string. ~org-element-timestamp-parser~ now adds =:repeater-deadline-value= and =:repeater-deadline-unit= properties to each timestamp object that has -a repeater deadline. +a repeater deadline. For example, in =<2012-03-29 Thu ++1y/2y>=, =2y= +is the repeater deadline with a value of =2= and unit of =y=. See +"5.3.3 Tracking your habits" section in the manual. Possible values for =:repeater-deadline-value=: ~positive integer~, ~nil~. diff --git a/lisp/org-element.el b/lisp/org-element.el index 49a312694..e7561f16f 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -4331,13 +4331,13 @@ (defun org-element-timestamp-parser () (and (not diaryp) (string-match (rx - (group (or "+" "++" ".+")) - (group (+ digit)) - (group (or "h" "d" "w" "m" "y")) - (\? + (group-n 1 (or "+" "++" ".+")) + (group-n 2 (+ digit)) + (group-n 3 (any "hdwmy")) + (optional "/" - (group (+ digit)) - (group (or "h" "d" "w" "m" "y")))) + (group-n 4 (+ digit)) + (group-n 5 (any "hdwmy")))) raw-value) (nconc (list @@ -4427,17 +4427,15 @@ (defun org-element-timestamp-interpreter (timestamp _) (and val (number-to-string val))) (pcase (org-element-property :repeater-unit timestamp) (`hour "h") (`day "d") (`week "w") (`month "m") (`year "y")) - (let ((repeater-deadline-value - (org-element-property :repeater-deadline-value timestamp)) - (repeater-deadline-unit - (org-element-property :repeater-deadline-unit timestamp))) - (if (and repeater-deadline-value repeater-deadline-unit) - (concat - "/" - (number-to-string repeater-deadline-value) - (pcase repeater-deadline-unit - (`hour "h") (`day "d") (`week "w") (`month "m") (`year "y"))) - "")))) + (when-let ((repeater-deadline-value + (org-element-property :repeater-deadline-value timestamp)) + (repeater-deadline-unit + (org-element-property :repeater-deadline-unit timestamp))) + (concat + "/" + (number-to-string repeater-deadline-value) + (pcase repeater-deadline-unit + (`hour "h") (`day "d") (`week "w") (`month "m") (`year "y")))))) (range-type (org-element-property :range-type timestamp)) (warning-string (concat --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=amendments-worg.diff diff --git a/org-syntax.org b/org-syntax.org index c8eb7f77..70a46dcf 100644 --- a/org-syntax.org +++ b/org-syntax.org @@ -1776,8 +1776,8 @@ ** Timestamps + TIME (optional) :: An instance of the pattern =H:MM= where =H= represents a one to two digit number (and can start with =0=), and =M= represents a single digit. -+ REPEATER-OR-DELAY (optional) :: An instance of a single REPEATER and/or an - instance of a single DELAY in any order. ++ REPEATER-OR-DELAY (optional) :: An instance of a single =REPEATER= and/or an + instance of a single =DELAY= in any order. + REPEATER (optional) :: An instance of the following pattern: #+begin_example MARK VALUE UNIT @@ -1786,18 +1786,18 @@ ** Timestamps Where MARK, VALUE and UNIT are not separated by whitespace characters. - MARK :: Either the string =+= (cumulative type), =++= (catch-up type), or =.+= (restart type). - - VALUE :: A number + - VALUE :: A number. - UNIT :: Either the character =h= (hour), =d= (day), =w= (week), =m= - (month), or =y= (year) + (month), or =y= (year). + DELAY (optional) :: An instance of the following pattern: #+begin_example MARK VALUE UNIT #+end_example Where MARK, VALUE and UNIT are not separated by whitespace characters. - MARK :: Either =-= (all type) or =--= (first type). - - VALUE :: A number + - VALUE :: A number. - UNIT :: Either the character =h= (hour), =d= (day), =w= (week), =m= - (month), or =y= (year) + (month), or =y= (year). *Examples* @@ -1807,6 +1807,7 @@ ** Timestamps [2004-08-24 Tue]--[2004-08-26 Thu] <2012-02-08 Wed 20:00 ++1d> <2030-10-05 Sat +1m -3d> +<2012-03-29 Thu ++1y/2y> #+end_example ** Text Markup --=-=-= Content-Type: text/plain -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at --=-=-=--