From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id qA0IAQq+p2RkbQAASxT56A (envelope-from ) for ; Fri, 07 Jul 2023 09:26:02 +0200 Received: from aspmx1.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 4OCJAAq+p2SKHwAAauVa8A (envelope-from ) for ; Fri, 07 Jul 2023 09:26:02 +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 696DD3343A for ; Fri, 7 Jul 2023 09:26:01 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=ViVAFirP; 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=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1688714761; 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=hZuqj/EEMT3B8dYWosOqWR68HHIWm6PTy5Wl6sjruWo=; b=Qeg5vcXyTrzs4upRVyArIVo/flTx5TH7CpRW7fJWYEp4NhQkvTojakdXOKbHnJApA2LpM1 yk2LJ6z6TU/EHll/3fygqTCNygtLb6cAmQZ1mlZDbd5k2zY3FacagTRQvbR5le0PTWHI6j rOGqlvWPvnEKEQ36HLXG4aC89RDsqpx9lTtDwIwbQri+/IWKf2xaWTa8IUMZLLRkl8CkiS STY0VxY/ioSq5j207OEUk3DSlVFBL9Pt4h2VuQtsuKgM2JBSRAL2k2iJyzRu0mWFLLi8tq mFpKZJ2VVnhzdyHNvNHlsghd2bdnD+pP4F9QmFRSx3kxwuMdf7KTIOnmjD8s2w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1688714761; a=rsa-sha256; cv=none; b=fl3bDyc3kRy0cGqYwbL19V9Bg7LrLC6LqCFJosrG5iQfdI2tfCTX5tOI3nPFLLWwtNbkX3 thqO9lSLMHeUU8kuufim05CYHORyT4IiK0X8A9C7lxZu1Cr5nxL/AsxdxxybrFZDk95VqE 8Ea+RkRnCyT0J36E0INTGBGIgweCk0XX9Hj6q3JdSzDzEC/o5cz8O82L1cL+TBzXAtcE1W OMVsVV7rvaSQsWIHdaeFiB1Gz5VZU2yzDv50vjFn4EXbPEbK7drV7B3qo2fTUlqi+I3C9q aUw0BxhFt7ogtPAuI+Yec9vUs32KENNSR2qA8HDb8El0VuXAf2ODUFAaWWpqdA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=ViVAFirP; 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=gmail.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qHfpt-00070A-Ic; Fri, 07 Jul 2023 03:25:01 -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 1qHfpl-0006tK-KU for emacs-orgmode@gnu.org; Fri, 07 Jul 2023 03:24:55 -0400 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qHfpi-0001Gd-F5 for emacs-orgmode@gnu.org; Fri, 07 Jul 2023 03:24:53 -0400 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2b6fdaf6eefso23532941fa.0 for ; Fri, 07 Jul 2023 00:24:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688714688; x=1691306688; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=hZuqj/EEMT3B8dYWosOqWR68HHIWm6PTy5Wl6sjruWo=; b=ViVAFirPEn/ekJOs/QrGLIgb+BSOSZf63+r/u4J0T32RkqLHHwSorjtfxjmFeB0UPn 6kn5v/T3QdaTOYPHnn0lt14ItcFPyVvghL7lgaaFz7IjambSrwyZ9Jr0cpIvJw7wUKq+ 89aAVN18RcAaPl3I5+inG2CKpVqFqAbVxHtOOf3OwV0H7Sw2hrM+J72B0m0SqXbJZEB+ EV7KxhbaUI62K3q+ATh8LzVGhrtHbrQ0IXQblc1GDawwUluwq/joGecWNgmavqn+/5ah ZkeVqBGFQAR7jVYU2S94aWtqq0FhkeX+MDlinc68x5N2mN/exxOnon7Zt8tPPJWRs0AI tkiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688714688; x=1691306688; h=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=hZuqj/EEMT3B8dYWosOqWR68HHIWm6PTy5Wl6sjruWo=; b=U2Nt9B7SNBxx3//rNDQ0NOKPsVX0Cpeh+wzNhz2tDHR3lw8MRRYEkjf7L8i69fojqi uQ/r/b9YGCN6EpU2FcNG/dzZ9dSEwvP0ajvUds/F3xLGONMy2KqqsY1PlZA+t4lLqxq2 mhsdPJT66CKcr49a2oZARS1isxL9vY4dawofnF7hBGSrWaSxTVkyOp2qlHCqW3Dj4NgB IFlfVjXy5VHJUJF7jl+VRDbSlXfdxkRW3PRga6seMm88eKWQQFyFdGAnngLCm8EK2wmO FPkxal/42b/VXf7JdaA6waCz8dCgJe3s2ZFOOfQffaUp9GhiJWV0bbPtMa5MJKbtLWwX RRTA== X-Gm-Message-State: ABy/qLaxP/RvMw90RLGbM5bGFC2JEdiuo9X4Jvp0lFEsbqCSjC4kNaT5 i6fvRASjRbfj/4wUk1jEHqQsrQP95Txh/w== X-Google-Smtp-Source: APBJJlGsMAfNyndnZ0oWKVqzl0vDATjBJra8ZS2ChlMaUK36fWWMSVE2sxor9Bc+skcNlEGtW3qg1Q== X-Received: by 2002:a19:655c:0:b0:4fb:744e:17db with SMTP id c28-20020a19655c000000b004fb744e17dbmr3034926lfj.1.1688714687397; Fri, 07 Jul 2023 00:24:47 -0700 (PDT) Received: from sonyvaio ([217.71.131.234]) by smtp.gmail.com with ESMTPSA id e2-20020ac25462000000b004fbc47e95c0sm564131lfn.44.2023.07.07.00.24.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jul 2023 00:24:46 -0700 (PDT) From: Ilya Chernyshov To: Ihor Radchenko Cc: emacs-orgmode Subject: Re: [PATCH] org-element-timestamp-interpreter: Return daterange anyway, if DATERANGE is non-nil In-Reply-To: <87wmzi4s6n.fsf@localhost> References: <87y1ot6dqz.fsf@gmail.com> <87wn4cegt4.fsf@localhost> <9E22693E-7D20-470A-B57B-EA17BBE9160F@gmail.com> <87a616c5do.fsf@localhost> <87wmzi4s6n.fsf@localhost> Date: Fri, 07 Jul 2023 14:24:42 +0700 Message-ID: <87edlkyyit.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::22a; envelope-from=ichernyshovvv@gmail.com; helo=mail-lj1-x22a.google.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_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: -4.94 X-Spam-Score: -4.94 X-Migadu-Queue-Id: 696DD3343A X-Migadu-Scanner: mx2.migadu.com X-TUID: rdF6RxWedOeh --=-=-= Content-Type: text/plain Ihor Radchenko writes: > Some general stylistic comments: > 1. You left some whitespace-only blank lines and spaces at the end of > lines. Please, clean them up. > 2. Please, use double space between sentences in the commit message and > link to this thread. See > https://orgmode.org/worg/org-contribute.html#commit-messages > 3. I noticed some (let((...) forms. Please put spaces between sexps like > (let ((...) > ^ space here I'm sorry for incorrect formatting. Fixed. > Here, you are manually constructing time part of the timestamp, > bypassing `org-time-stamp-format' and `org-timestamp-formats'. Please, > use `org-time-stamp-format' for times as well. > If necessary, feed free to extend `org-time-stamp-format' and the value > of `org-timestamp-formats' constant. I used `org-time-stamp-format' for start time, but I didn't come with the idea on how to format end time in the current context, so I just used `(format "-%02d:%02d" hour-end minute-end)'. > `string-replace' is fragile here. If we ever need to put "<" or ">" > inside timestamp, random breakages may happen. Please, rewrite. Fixed. > Interpreting timestamps with :time-range nil and > :day-end/:year-end/:month-end non-nil as timerange is a breaking change. > Let's avoid it. Timestamp objects (ranges) with :range-type nil are now interpreted as dateranges, as it was before. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-lisp-org-element.el-Add-new-timestamp-property-range.patch >From 4ee8b8bc065c208374d7a516a7c8dc9fb7d0fe5e Mon Sep 17 00:00:00 2001 From: Ilya Chernyshov Date: Sat, 18 Feb 2023 14:55:39 +0700 Subject: [PATCH] lisp/org-element.el: Add new timestamp property :range-type * lisp/org-element (org-element-timestamp-interpreter): Take into account :range-type value when interpreting ranges. When start and end dates are equal and :range-type is `timerange', return a timerange (). If :range-type is `daterange' always return a daterange (<...>--<...>). When :range-type is nil, return a daterange for any range (as it was before). (org-element-timestamp-parser): Add :range-type property. * testing/lisp/test-org-element (test-org-element/timestamp-interpreter): Add new tests. (test-org-element/timestamp-parser): Add testing for :range-type property. * etc/ORG-NEWS (Major changes and additions to Org API): Add news about this property. --- etc/ORG-NEWS | 7 ++ lisp/org-element.el | 177 +++++++++++++++---------------- testing/lisp/test-org-element.el | 121 ++++++++++++++++++++- 3 files changed, 210 insertions(+), 95 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index d04e92275..d8d2275d9 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -200,6 +200,13 @@ a newly created one. Previously, one had to use : (apply #'org-element-create 'section nil (org-element-contents node)) +**** New property ~:range-type~ for org-element timestamp object + +~org-element-timestamp-parser~ now adds =:range-type= property to each +timestamp object. Possible values: ~timerange~, ~daterange~, ~nil~. + +~org-element-timestamp-interpreter~ takes into account this property +and returns approptiate timestamp string. *** ~org-priority=show~ command no longer adjusts for scheduled/deadline diff --git a/lisp/org-element.el b/lisp/org-element.el index bfb1d206e..c6b2d81a1 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -4043,7 +4043,7 @@ Assume point is at the target." "Parse time stamp at point, if any. When at a time stamp, return a new syntax node of `timestamp' type -containing `:type', `:raw-value', `:year-start', `:month-start', +containing `:type', `:range-type', `:raw-value', `:year-start', `:month-start', `:day-start', `:hour-start', `:minute-start', `:year-end', `:month-end', `:day-end', `:hour-end', `:minute-end', `:repeater-type', `:repeater-value', `:repeater-unit', @@ -4077,6 +4077,10 @@ Assume point is at the beginning of the timestamp." (activep 'active) ((or date-end time-range) 'inactive-range) (t 'inactive))) + (range-type (cond + (date-end 'daterange) + (time-range 'timerange) + (t nil))) (repeater-props (and (not diaryp) (string-match "\\([.+]?\\+\\)\\([0-9]+\\)\\([hdwmy]\\)" @@ -4123,6 +4127,7 @@ Assume point is at the beginning of the timestamp." (org-element-create 'timestamp (nconc (list :type type + :range-type range-type :raw-value raw-value :year-start year-start :month-start month-start @@ -4142,98 +4147,84 @@ Assume point is at the beginning of the timestamp." (defun org-element-timestamp-interpreter (timestamp _) "Interpret TIMESTAMP object as Org syntax." - (let* ((repeat-string - (concat - (pcase (org-element-property :repeater-type timestamp) - (`cumulate "+") (`catch-up "++") (`restart ".+")) - (let ((val (org-element-property :repeater-value timestamp))) - (and val (number-to-string val))) - (pcase (org-element-property :repeater-unit timestamp) - (`hour "h") (`day "d") (`week "w") (`month "m") (`year "y")))) - (warning-string - (concat - (pcase (org-element-property :warning-type timestamp) - (`first "--") (`all "-")) - (let ((val (org-element-property :warning-value timestamp))) - (and val (number-to-string val))) - (pcase (org-element-property :warning-unit timestamp) - (`hour "h") (`day "d") (`week "w") (`month "m") (`year "y")))) - (build-ts-string - ;; Build an Org timestamp string from TIME. ACTIVEP is - ;; non-nil when time stamp is active. If WITH-TIME-P is - ;; non-nil, add a time part. HOUR-END and MINUTE-END - ;; specify a time range in the timestamp. REPEAT-STRING is - ;; the repeater string, if any. - (lambda (time activep &optional with-time-p hour-end minute-end) - (let ((ts (format-time-string - (org-time-stamp-format with-time-p) - time))) - (when (and hour-end minute-end) - (string-match "[012]?[0-9]:[0-5][0-9]" ts) - (setq ts - (replace-match - (format "\\&-%02d:%02d" hour-end minute-end) - nil nil ts))) - (unless activep (setq ts (format "[%s]" (substring ts 1 -1)))) - (dolist (s (list repeat-string warning-string)) - (when (org-string-nw-p s) - (setq ts (concat (substring ts 0 -1) - " " - s - (substring ts -1))))) - ;; Return value. - ts))) - (type (org-element-property :type timestamp))) - (pcase type - ((or `active `inactive) - (let* ((minute-start (org-element-property :minute-start timestamp)) - (minute-end (org-element-property :minute-end timestamp)) - (hour-start (org-element-property :hour-start timestamp)) - (hour-end (org-element-property :hour-end timestamp)) - (time-range-p (and hour-start hour-end minute-start minute-end - (or (/= hour-start hour-end) - (/= minute-start minute-end))))) - (funcall - build-ts-string - (org-encode-time 0 - (or minute-start 0) - (or hour-start 0) - (org-element-property :day-start timestamp) - (org-element-property :month-start timestamp) - (org-element-property :year-start timestamp)) - (eq type 'active) - (and hour-start minute-start) - (and time-range-p hour-end) - (and time-range-p minute-end)))) - ((or `active-range `inactive-range) - (let ((minute-start (org-element-property :minute-start timestamp)) - (minute-end (org-element-property :minute-end timestamp)) - (hour-start (org-element-property :hour-start timestamp)) - (hour-end (org-element-property :hour-end timestamp))) - (concat - (funcall - build-ts-string (org-encode-time - 0 - (or minute-start 0) - (or hour-start 0) - (org-element-property :day-start timestamp) - (org-element-property :month-start timestamp) - (org-element-property :year-start timestamp)) - (eq type 'active-range) - (and hour-start minute-start)) - "--" - (funcall build-ts-string - (org-encode-time - 0 - (or minute-end 0) - (or hour-end 0) - (org-element-property :day-end timestamp) - (org-element-property :month-end timestamp) - (org-element-property :year-end timestamp)) - (eq type 'active-range) - (and hour-end minute-end))))) - (_ (org-element-property :raw-value timestamp))))) - + (if (member + (org-element-property :type timestamp) + '(active inactive inactive-range active-range)) + (let ((day-start (org-element-property :day-start timestamp)) + (month-start (org-element-property :month-start timestamp)) + (year-start (org-element-property :year-start timestamp))) + (when (and day-start month-start year-start) + (let* ((repeat-string + (concat + (pcase (org-element-property :repeater-type timestamp) + (`cumulate "+") (`catch-up "++") (`restart ".+")) + (let ((val (org-element-property :repeater-value timestamp))) + (and val (number-to-string val))) + (pcase (org-element-property :repeater-unit timestamp) + (`hour "h") (`day "d") (`week "w") (`month "m") (`year "y")))) + (range-type (org-element-property :range-type timestamp)) + (warning-string + (concat + (pcase (org-element-property :warning-type timestamp) + (`first "--") (`all "-")) + (let ((val (org-element-property :warning-value timestamp))) + (and val (number-to-string val))) + (pcase (org-element-property :warning-unit timestamp) + (`hour "h") (`day "d") (`week "w") (`month "m") (`year "y")))) + (hour-start (org-element-property :hour-start timestamp)) + (minute-start (org-element-property :minute-start timestamp)) + (hour-end (or (org-element-property :hour-end timestamp) hour-start)) + (minute-end (or (org-element-property :minute-end timestamp) minute-start)) + (day-end (or (org-element-property :day-end timestamp) day-start)) + (month-end (or (org-element-property :month-end timestamp) month-start)) + (year-end (or (org-element-property :year-end timestamp) year-start)) + (time-range-p (and hour-start minute-start minute-end hour-end + (or (/= hour-start hour-end) + (/= minute-start minute-end)))) + (date-range-p (or (and (eq range-type nil) time-range-p) + (and day-end month-end year-end + (or + (/= day-start day-end) + (/= month-start month-end) + (/= year-start year-end))))) + (brackets + (if (member + (org-element-property :type timestamp) + '(inactive inactive-range)) + (cons "[" "]") + (cons "<" ">")))) + (concat + (car brackets) + (format-time-string + (org-time-stamp-format (and (integerp minute-start) (integerp hour-start)) 'no-brackets) + (org-encode-time + 0 + (or minute-start 0) + (or hour-start 0) + day-start + month-start + year-start)) + (cond + ((or date-range-p (eq range-type 'daterange)) + (concat + (and (org-string-nw-p repeat-string) (concat " " repeat-string)) + (and (org-string-nw-p warning-string) (concat " " warning-string)) + (cdr brackets) + "--" (car brackets) + (format-time-string + (org-time-stamp-format (and (integerp minute-end) (integerp hour-end)) 'no-brackets) + (org-encode-time + 0 + (or minute-end 0) + (or hour-end 0) + day-end + month-end + year-end)))) + ((and time-range-p (eq range-type 'timerange)) (format "-%02d:%02d" hour-end minute-end))) + (and (org-string-nw-p repeat-string) (concat " " repeat-string)) + (and (org-string-nw-p warning-string) (concat " " warning-string)) + (cdr brackets))))) + (org-element-property :raw-value timestamp))) ;;;; Underline diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el index 283ade10f..1c083628d 100644 --- a/testing/lisp/test-org-element.el +++ b/testing/lisp/test-org-element.el @@ -3138,8 +3138,73 @@ Outside list" (org-test-with-temp-text "<2012-03-29 Thu +1y -1y>" (let ((ts (org-element-context))) (list (org-element-property :repeater-type ts) - (org-element-property :warning-type ts))))))) - + (org-element-property :warning-type ts)))))) + ;; :range-type property + (should + (eq + (org-test-with-temp-text "<2023-07-02 Sun>" + (org-element-property :range-type (org-element-timestamp-parser))) + nil)) + (should + (eq + (org-test-with-temp-text "<2023-07-02 Sun 12:00>" + (org-element-property :range-type (org-element-timestamp-parser))) + nil)) + (should + (eq + (org-test-with-temp-text "<2023-07-02 Sun 12:00-13:00>" + (org-element-property :range-type (org-element-timestamp-parser))) + 'timerange)) + (should + (eq + (org-test-with-temp-text "<2023-07-02 Sun 12:00-12:00>" + (org-element-property :range-type (org-element-timestamp-parser))) + 'timerange)) + (should + (eq + (org-test-with-temp-text "<2023-07-02 Sun>--<2023-07-02 Sun>" + (org-element-property :range-type (org-element-timestamp-parser))) + 'daterange)) + (should + (eq + (org-test-with-temp-text "<2023-07-02 Sun>--<2023-07-03 Mon>" + (org-element-property :range-type (org-element-timestamp-parser))) + 'daterange)) + (should + (eq + (org-test-with-temp-text "<2023-07-02 Sun 12:00>--<2023-07-02 Sun 12:00>" + (org-element-property :range-type (org-element-timestamp-parser))) + 'daterange)) + (should + (eq + (org-test-with-temp-text "<2023-07-02 Sun 12:00>--<2023-07-03 Mon 13:00>" + (org-element-property :range-type (org-element-timestamp-parser))) + 'daterange)) + (should + (eq + (org-test-with-temp-text "<2023-07-02 Sun 12:00>--<2023-07-02 Sun>" + (org-element-property :range-type (org-element-timestamp-parser))) + 'daterange)) + (should + (eq + (org-test-with-temp-text "<2023-07-02 Sun 12:00>--<2023-07-03 Mon>" + (org-element-property :range-type (org-element-timestamp-parser))) + 'daterange)) + (should + (eq + (org-test-with-temp-text "<2023-07-02 Sun 12:00>--<2023-07-02 Sun 13:00>" + (org-element-property :range-type (org-element-timestamp-parser))) + 'daterange)) + (should + (eq + (org-test-with-temp-text "<2023-07-02 Sun 12:00>--<2023-07-02 Sun>" + (org-element-property :range-type (org-element-timestamp-parser))) + 'daterange)) + (should + (eq + (org-test-with-temp-text "<2023-07-02 Sun 12:00 +5d>--<2023-07-02 Sun 13:00>" + (org-element-property :range-type (org-element-timestamp-parser))) + 'daterange))) ;;;; Underline @@ -3697,10 +3762,40 @@ DEADLINE: <2012-03-29 thu.> SCHEDULED: <2012-03-29 thu.> CLOSED: [2012-03-29 thu (:type inactive :year-start 2012 :month-start 3 :day-start 29 :hour-start 16 :minute-start 40)) nil))) ;; Active range. + + ;; range-type: daterange; parse-and-interpret (should (string-match "<2012-03-29 .* 16:40>--<2012-03-29 .* 16:41>" (org-test-parse-and-interpret "<2012-03-29 thu. 16:40>--<2012-03-29 thu. 16:41>"))) + + ;; range-type: daterange; interpreter + (should + (string-match + "<2012-03-29 .* 16:40>--<2012-03-29 .* 16:41>" + (org-element-timestamp-interpreter + '(timestamp + (:type active-range :range-type daterange :year-start 2012 :month-start 3 :day-start 29 + :hour-start 16 :minute-start 40 :year-end 2012 :month-end 3 + :day-end 29 :hour-end 16 :minute-end 41)) nil))) + + ;; range-type: timerange; parse-and-interpret + (should + (string-match "<2012-03-29 .* 16:40-16:41>" + (org-test-parse-and-interpret + "<2012-03-29 thu. 16:40-16:41>"))) + + ;; range-type: timerange; interpreter + (should + (string-match + "<2012-03-29 .* 16:40-16:41>" + (org-element-timestamp-interpreter + '(timestamp + (:type active-range :range-type timerange :year-start 2012 :month-start 3 :day-start 29 + :hour-start 16 :minute-start 40 :year-end 2012 :month-end 3 + :day-end 29 :hour-end 16 :minute-end 41)) nil))) + + ;; range-type: nil; date-start and date-end are equal; interpreter (should (string-match "<2012-03-29 .* 16:40>--<2012-03-29 .* 16:41>" @@ -3709,11 +3804,32 @@ DEADLINE: <2012-03-29 thu.> SCHEDULED: <2012-03-29 thu.> CLOSED: [2012-03-29 thu (:type active-range :year-start 2012 :month-start 3 :day-start 29 :hour-start 16 :minute-start 40 :year-end 2012 :month-end 3 :day-end 29 :hour-end 16 :minute-end 41)) nil))) + + ;; range-type: nil; date-start and date-end aren't equal; interpreter + (should + (string-match + "<2012-03-29 .* 16:40>--<2012-03-30 .* 16:41>" + (org-element-timestamp-interpreter + '(timestamp + (:type active-range :year-start 2012 :month-start 3 :day-start 29 + :hour-start 16 :minute-start 40 :year-end 2012 :month-end 3 + :day-end 30 :hour-end 16 :minute-end 41)) nil))) + ;; Inactive range. (should (string-match "\\[2012-03-29 .* 16:40\\]--\\[2012-03-29 .* 16:41\\]" (org-test-parse-and-interpret "[2012-03-29 thu. 16:40]--[2012-03-29 thu. 16:41]"))) + + (should + (string-match + "\\[2012-03-29 .* 16:40-16:41\\]" + (org-element-timestamp-interpreter + '(timestamp + (:type inactive-range :range-type timerange :year-start 2012 :month-start 3 :day-start 29 + :hour-start 16 :minute-start 40 :year-end 2012 :month-end 3 + :day-end 29 :hour-end 16 :minute-end 41)) nil))) + (should (string-match "\\[2012-03-29 .* 16:40\\]--\\[2012-03-29 .* 16:41\\]" @@ -3722,6 +3838,7 @@ DEADLINE: <2012-03-29 thu.> SCHEDULED: <2012-03-29 thu.> CLOSED: [2012-03-29 thu (:type inactive-range :year-start 2012 :month-start 3 :day-start 29 :hour-start 16 :minute-start 40 :year-end 2012 :month-end 3 :day-end 29 :hour-end 16 :minute-end 41)) nil))) + ;; Diary. (should (equal (org-test-parse-and-interpret "<%%diary-float t 4 2>") "<%%diary-float t 4 2>\n")) -- 2.40.1 --=-=-=--