From: Jack Kamm <jackkamm@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: emacs-orgmode@gnu.org, mail@nicolasgoaziou.fr
Subject: Re: [PATCH] ox-icalendar: Unscheduled tasks & repeating tasks
Date: Sat, 17 Jun 2023 10:32:43 -0700 [thread overview]
Message-ID: <87ilbmro3o.fsf@gmail.com> (raw)
In-Reply-To: <87wn09m0gz.fsf@localhost>
[-- Attachment #1: Type: text/plain, Size: 643 bytes --]
Ihor Radchenko <yantar92@posteo.net> 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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-ox-icalendar-Display-warning-for-unsupported-repeate.patch --]
[-- Type: text/x-patch, Size: 4906 bytes --]
From 80c05e00335062cc96bdcd85ec507066af4a1d3b Mon Sep 17 00:00:00 2001
From: Jack Kamm <jackkamm@gmail.com>
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0003-ox-icalendar-Links-in-docs-for-org-icalendar-todo-un.patch --]
[-- Type: text/x-patch, Size: 2104 bytes --]
From 94f1c01273878e2a7403c1d47ebabe40595de23d Mon Sep 17 00:00:00 2001
From: Jack Kamm <jackkamm@gmail.com>
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
next prev parent reply other threads:[~2023-06-17 17:33 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-26 18:56 [RFC] ox-icalendar: Unscheduled tasks & repeating tasks Jack Kamm
2023-03-27 11:59 ` Ihor Radchenko
2023-03-31 5:55 ` Jack Kamm
2023-03-31 13:07 ` Ihor Radchenko
2023-03-31 15:50 ` Jack Kamm
2023-03-31 17:51 ` Ihor Radchenko
2023-03-31 22:20 ` Jack Kamm
2023-04-01 8:30 ` Ihor Radchenko
2023-04-02 0:47 ` Jack Kamm
2023-04-02 8:48 ` Ihor Radchenko
2023-04-02 15:34 ` Jack Kamm
2023-04-02 16:32 ` Ihor Radchenko
2023-04-14 16:57 ` Jack Kamm
2023-04-14 18:46 ` Ihor Radchenko
2023-04-15 3:13 ` Jack Kamm
2023-04-15 9:56 ` Ihor Radchenko
2023-04-16 17:19 ` Jack Kamm
2023-06-11 15:35 ` [PATCH] " Jack Kamm
2023-06-12 10:36 ` Ihor Radchenko
2023-06-17 17:32 ` Jack Kamm [this message]
2023-06-18 11:28 ` Ihor Radchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ilbmro3o.fsf@gmail.com \
--to=jackkamm@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=mail@nicolasgoaziou.fr \
--cc=yantar92@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).