From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id SMoWJ2/ujWSdygAASxT56A (envelope-from ) for ; Sat, 17 Jun 2023 19:33:35 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 2Nf7Jm/ujWQ2HgAAauVa8A (envelope-from ) for ; Sat, 17 Jun 2023 19:33:35 +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 331992C019 for ; Sat, 17 Jun 2023 19:33:35 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qAZn9-0003j1-CZ; Sat, 17 Jun 2023 13:32:51 -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 1qAZn7-0003io-84 for emacs-orgmode@gnu.org; Sat, 17 Jun 2023 13:32:49 -0400 Received: from mail-oa1-x34.google.com ([2001:4860:4864:20::34]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qAZn5-0005iX-7V for emacs-orgmode@gnu.org; Sat, 17 Jun 2023 13:32:48 -0400 Received: by mail-oa1-x34.google.com with SMTP id 586e51a60fabf-19f8af9aa34so1998345fac.1 for ; Sat, 17 Jun 2023 10:32:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687023165; x=1689615165; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=xbgTUApKMbKK94PJiMmndmHxPzT3cVIt0B4WIMEGEUQ=; b=VqnWW+k7In3gjP4UStNgZSruq2cUanNRdoE7n1UslSuAYed8HZ3IsT8xFkPUD274u8 MfsAlw/OWEa+z1OqXyMt5MSVp8fKWb33zzPzEBeaMupiBmUIXD39xKDJlG67pbP8kDD1 x7SRc+0Drid6/eeQXPqftxFnGDxoDqXSJT8qlFhOCI8B8Izw/w4dD6f0iK+qTzyoSbPV ewbydGQxbATWCrhprhdsAwqGkeBHGt3qVtxMWwW5Vl2UpYyCzyERsFtDKISkFuEN+kb/ xXwKmrY42VJUQJBQiluwPrYaEUXouteA2lZi08GAQIv+H2gUyqsOg+g7g6dNw6GTTdWX VdFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687023165; x=1689615165; 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=xbgTUApKMbKK94PJiMmndmHxPzT3cVIt0B4WIMEGEUQ=; b=D7i1mxal6hqh1q5GHEvSHVW098T4nEYP/8vul/tBB+cw/3RsIBEaKPSrtCEls3xY+D GzlKvMFgY1iOySrGmOTMIE3wGCe03Ceao8oxWnfYHTxO2Fnx5Wn27dUEsZsN9Vuf1rUY 9pDb3M8IGnVnfr8PdSM/lqx0ylcjkFCyGRnP3OaO7sTJXmkzNm1yUIDe5CvkYZjJkJbn G0837wuIG0KJNIHB+1X1Er79W03hsAlTOmbfSAVUne+eMQiNEIwc2bcJnYTGsnekWm2O Xb4Znk/WomlYigNE0aidnU86jy9AeL//YHklOZH5JenXuPUKWw4gFdXlpay5QDIv2pql U+hw== X-Gm-Message-State: AC+VfDxfOprAVfjAWTwAfn4HW+ZGTPcTrWqvUpfng5NeCkLfLoldKwx1 tCRJr4DnSOxTfq0cWem/YJpo8NarswA= X-Google-Smtp-Source: ACHHUZ6HWefnEwdhrlWH3UkLtkGTvFbiEBHc5Zqi8b9xnE9y/k2vHeChWYv0pAIR2MyemyiIeZXjRw== X-Received: by 2002:a05:6870:1a98:b0:1a9:a899:cb52 with SMTP id ef24-20020a0568701a9800b001a9a899cb52mr2623682oab.1.1687023165471; Sat, 17 Jun 2023 10:32:45 -0700 (PDT) Received: from localhost (157-131-78-143.fiber.dynamic.sonic.net. [157.131.78.143]) by smtp.gmail.com with ESMTPSA id i21-20020aa78b55000000b0064fc715b380sm15721157pfd.176.2023.06.17.10.32.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Jun 2023 10:32:44 -0700 (PDT) From: Jack Kamm To: Ihor Radchenko Cc: emacs-orgmode@gnu.org, mail@nicolasgoaziou.fr Subject: Re: [PATCH] ox-icalendar: Unscheduled tasks & repeating tasks In-Reply-To: <87wn09m0gz.fsf@localhost> References: <874jq75okg.fsf@gmail.com> <87o7oetneo.fsf@localhost> <87sfay3tbd.fsf@gmail.com> <87wn09m0gz.fsf@localhost> Date: Sat, 17 Jun 2023 10:32:43 -0700 Message-ID: <87ilbmro3o.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2001:4860:4864:20::34; envelope-from=jackkamm@gmail.com; helo=mail-oa1-x34.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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1687023215; 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=xbgTUApKMbKK94PJiMmndmHxPzT3cVIt0B4WIMEGEUQ=; b=gQ1XAadGTehRofl1yIarv8QR1vYVjR2F7aW8AAwJl127WcIOhAiaZIPcgWz//OplBBBnHP HJkE6P/LFjyrV6Yky4wFhpxUzq9hEZmOve8VUzgyAFCKKOIn/gItYTxB+ys2xE+kwGvf4U x8UkHrH0gZs4aeTVKJJjOK+XXfX1ImGTmFB5GGNj055I2Ux7/67IM5p5cr8xiXrE415Acu PjormI3g8RSYoVRqGabdxj9QkwByLJ8VAnxheVopXGmzVlG13cDAEDJpioGDaGGHc9vZTz JcHmFbmHIq6eWHCXv90TYkKRy4SJVqnCZ5fycbmis0aFbUy9W0ocD6wsGpbmLg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=VqnWW+k7; dmarc=pass (policy=none) header.from=gmail.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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1687023215; a=rsa-sha256; cv=none; b=O8d6R/HQkjgDzKZiAeSZhrw4h8Gw6ZJoMNOZwGBA/hLKKIxnJfNcne4BmStjS77IF7JGs2 /1KP+nM01qiJrzdJJ9YGxJrmLGRl5mVzQELPFJgHJyre+icEp9CRett3ZHewtkjLEVh8+g NQwsurI+cjVvSjGrqEPtRc/+nhL4CDaEC4Q/O421kwE1JSQXOtPQgKJFLLEKnEzog7ILrf KkWXnv7kyhUSt0mazRHV/YOrzjpG4vy2oGXE4aCqPanAAEuGn2PrUTDC19mYuEceE0zQq8 HNbW16JjnYdc/a5WVX1zvrTpLrRqIyCx7IR1GkjuOVb6H5GcOMRS3csp+L7kUA== X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -4.89 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=VqnWW+k7; dmarc=pass (policy=none) header.from=gmail.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: 331992C019 X-Spam-Score: -4.89 X-TUID: IazJT1s5kvv4 --=-=-= Content-Type: text/plain Ihor Radchenko writes: > Would it make sense to throw a warning instead of silently skipping ~++~ > and ~.+~ repeaters? > > I think it would make sense to link to this variable in the > `org-icalendar-use-scheduled' docstring and possibly in the manual. Thanks, I agree. I've updated the patch to add a warning for the nonstandard repeaters (plus a unit test), and also added links to `org-icalendar-todo-unscheduled-start' in the manual and `org-icalendar-use-scheduled' docstring. For convenience I attach these as separate patches here. If it looks OK I will squash with the prior patch before applying to main. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0002-ox-icalendar-Display-warning-for-unsupported-repeate.patch >From 80c05e00335062cc96bdcd85ec507066af4a1d3b Mon Sep 17 00:00:00 2001 From: Jack Kamm Date: Sat, 17 Jun 2023 07:55:17 -0700 Subject: [PATCH 2/3] ox-icalendar: Display warning for unsupported repeaters This commit to be squashed with the previous one * lisp/ox-icalendar.el (org-icalendar--repeater-type): Helper function to get the repeater type, and display warning if not supported. * testing/lisp/test-ox-icalendar.el (test-ox-icalendar/warn-unsupported-repeater): Unit test to warn for unsupported repeater types. --- lisp/ox-icalendar.el | 30 +++++++++++++++++++++--------- testing/lisp/test-ox-icalendar.el | 14 ++++++++++++++ 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el index 8c569752b..0dbc623b4 100644 --- a/lisp/ox-icalendar.el +++ b/lisp/ox-icalendar.el @@ -810,6 +810,23 @@ (\"PUBLIC\", \"CONFIDENTIAL\", and \"PRIVATE\") are predefined, others (org-icalendar--valarm entry timestamp summary) "END:VEVENT"))) +(defun org-icalendar--repeater-type (elem) + "Return ELEM's repeater-type if supported, else warn and return nil." + (let ((repeater-value (org-element-property :repeater-value elem)) + (repeater-type (org-element-property :repeater-type elem))) + (cond + ((not (and repeater-type + repeater-value + (> repeater-value 0))) + nil) + ;; TODO Add catch-up to supported repeaters (use EXDATE to implement) + ((not (memq repeater-type '(cumulate))) + (org-display-warning + (format "Repeater-type %s not currently supported by iCalendar export" + (symbol-name repeater-type))) + nil) + (repeater-type)))) + (defun org-icalendar--vtodo (entry uid summary location description categories timezone class) "Create a VTODO component. @@ -826,13 +843,8 @@ (defun org-icalendar--vtodo (org-element-property :scheduled entry))) (dl (and (memq 'todo-due org-icalendar-use-deadline) (org-element-property :deadline entry))) - ;; TODO Implement catch-up repeaters using EXDATE - (sc-repeat-p (and (eq (org-element-property :repeater-type sc) - 'cumulate) - (> (org-element-property :repeater-value sc) 0))) - (dl-repeat-p (and (eq (org-element-property :repeater-type dl) - 'cumulate) - (> (org-element-property :repeater-value dl) 0))) + (sc-repeat-p (org-icalendar--repeater-type sc)) + (dl-repeat-p (org-icalendar--repeater-type dl)) (repeat-value (or (org-element-property :repeater-value sc) (org-element-property :repeater-value dl))) (repeat-unit (or (org-element-property :repeater-unit sc) @@ -881,14 +893,14 @@ (defun org-icalendar--vtodo (eq repeat-unit (org-element-property :repeater-unit dl))))) ;; TODO Implement via RDATE with changing DURATION - (warn "Not yet implemented: \ + (org-display-warning "Not yet implemented: \ different repeaters on SCHEDULED and DEADLINE. Skipping.") nil) ;; DEADLINE has repeater but SCHEDULED doesn't ((and dl-repeat-p (and sc (not sc-repeat-p))) ;; TODO SCHEDULED should only apply to first instance; ;; use RDATE with custom DURATION to implement that - (warn "Not yet implemented: \ + (org-display-warning "Not yet implemented: \ repeater on DEADLINE but not SCHEDULED. Skipping.") nil) ((or sc-repeat-p dl-repeat-p) diff --git a/testing/lisp/test-ox-icalendar.el b/testing/lisp/test-ox-icalendar.el index 6a0c961d7..e631b2119 100644 --- a/testing/lisp/test-ox-icalendar.el +++ b/testing/lisp/test-ox-icalendar.el @@ -114,5 +114,19 @@ (ert-deftest test-ox-icalendar/todo-repeater-until-utc () (should (re-search-forward "RRULE:FREQ=DAILY;INTERVAL=3;UNTIL=2023050.T..0000Z")))) (when (file-exists-p tmp-ics) (delete-file tmp-ics))))) +(ert-deftest test-ox-icalendar/warn-unsupported-repeater () + "Test warning is emitted for unsupported repeater type." + (let ((org-icalendar-include-todo 'all)) + (should + (member + "Repeater-type restart not currently supported by iCalendar export" + (org-test-capture-warnings + (let ((tmp-ics (org-test-with-temp-text-in-file + "* TODO Unsupported restart repeater +SCHEDULED: <2023-03-26 Sun .+1m>" + (expand-file-name (org-icalendar-export-to-ics))))) + (when (file-exists-p tmp-ics) + (delete-file tmp-ics)))))))) + (provide 'test-ox-icalendar) ;;; test-ox-icalendar.el ends here -- 2.40.1 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0003-ox-icalendar-Links-in-docs-for-org-icalendar-todo-un.patch >From 94f1c01273878e2a7403c1d47ebabe40595de23d Mon Sep 17 00:00:00 2001 From: Jack Kamm Date: Sat, 17 Jun 2023 09:59:18 -0700 Subject: [PATCH 3/3] ox-icalendar: Links in docs for org-icalendar-todo-unscheduled-start --- doc/org-manual.org | 6 ++++-- lisp/ox-icalendar.el | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index c11694849..89589e32a 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -16054,14 +16054,16 @@ standard iCalendar format. #+vindex: org-icalendar-include-todo #+vindex: org-icalendar-use-deadline #+vindex: org-icalendar-use-scheduled +#+vindex: org-icalendar-todo-unscheduled-start The iCalendar export backend can also incorporate TODO entries based on the configuration of the ~org-icalendar-include-todo~ variable. The backend exports plain timestamps as =VEVENT=, TODO items as =VTODO=, and also create events from deadlines that are in non-TODO items. The backend uses the deadlines and scheduling dates in Org TODO items for setting the start and due dates for the iCalendar TODO -entry. Consult the ~org-icalendar-use-deadline~ and -~org-icalendar-use-scheduled~ variables for more details. +entry. Consult the ~org-icalendar-use-deadline~, +~org-icalendar-use-scheduled~, and +~org-icalendar-todo-unscheduled-start~ variables for more details. #+vindex: org-icalendar-categories #+vindex: org-icalendar-alarm-time diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el index 0dbc623b4..55ada8e60 100644 --- a/lisp/ox-icalendar.el +++ b/lisp/ox-icalendar.el @@ -168,8 +168,9 @@ (defcustom org-icalendar-use-scheduled '(todo-start) `todo-start' - Scheduling time stamps in TODO entries become start date. Some - calendar applications show TODO entries only after that date." + Scheduling time stamps in TODO entries become start date. (See + also `org-icalendar-todo-unscheduled-start', which controls the + start date for TODO entries without a scheduling time stamp)" :group 'org-export-icalendar :type '(set :greedy t -- 2.40.1 --=-=-=--