[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC] ox-icalendar: Unscheduled tasks & repeating tasks
From: |
Ihor Radchenko |
Subject: |
Re: [RFC] ox-icalendar: Unscheduled tasks & repeating tasks |
Date: |
Mon, 27 Mar 2023 11:59:59 +0000 |
Jack Kamm <jackkamm@gmail.com> writes:
> For patch 1 (unscheduled tasks):
>
> Currently, ox-icalendar does not allow creating an iCalendar task
> without a scheduled start date. If an Org TODO is missing a SCHEDULED
> timestamp, then ox-icalendar sets today as the scheduled start date for
> the exported task.
>
> Patch 1 changes this by adding a new customization
> org-icalendar-todo-force-scheduling. When non-nil, the start date is set
> to today (same as the current behavior). When nil, unscheduled Org TODOs
> are instead exported without a start date.
>
> I also propose the default value to be nil. Note, this is
> backwards-incompatible with the previous behavior!
>
> But I think it should be the default anyways, because IMO it is the more
> correct and useful behavior. An iCalendar VTODO without a DTSTART
> property is valid, and has the same meaning as an Org TODO without a
> SCHEDULED timestamp. Also, all the iCalendar programs I have tried
> support unscheduled tasks, including Thunderbird, Evolution, Nextcloud,
> and Tasks.org.
I agree that omitting DTSTART will make more sense.
> For patch 2 (repeating timestamps):
>
> I add recurrence rule (RRULE) export for repeating SCHEDULED and
> DEADLINE timestamps in TODOs, similar to how repeating non-TODO events
> are currently handled.
>
> The main complication here is that iCalendar's RRULE applies to both
> DTSTART and DUE properties; by contrast, Org's SCHEDULED and DEADLINE
> timestamps may have different repeaters. I am not sure the best way to
> handle the case where SCHEDULED and DEADLINE have different repeaters,
> so in that case I issue a warning and skip the repeater.
In the case of different repeaters, we can use RDATE
(https://icalendar.org/iCalendar-RFC-5545/3-8-5-2-recurrence-date-times.html)
and generate occurrences manually sufficiently far into future. ("how
far" should be a defcustom).
However, different repeaters for deadline and schedule are most likely a
mistake - we can report it via org-lint and in ox-icalendar, as warning.
Another scenario we may need to consider is when schedule has a repeater
while deadline does not, and vice versa. The former scenario is probably
valid - a VTODO with limited number of occurrences. The latter is likely
a mistake we should raise warning about. It is also not clear how to
represent moving event deadline in iCalendar.
See more inline comments below.
> +(defcustom org-icalendar-todo-force-scheduling nil
> + "Non-nil means unscheduled tasks are exported as scheduled.
> +The current date is used as the scheduled time for such tasks."
> + :group 'org-export-icalendar
> + :type 'boolean)
Please add :package-version and possibly :safe keywords.
We may also refer to `org-icalendar-include-todo' in the docstring.
> - (org-icalendar-convert-timestamp start "DTSTART" nil timezone) "\n"
> + (when start
> + (concat (org-icalendar-convert-timestamp
> + start "DTSTART" nil timezone)
> + "\n"))
Side note: here, and in other places, we use "\n" as end of line. Yet,
for example
https://icalendar.org/iCalendar-RFC-5545/3-8-2-4-date-time-start.html
prescribes CRLF (\r\n). Also, see
https://orgmode.org/list/87ilgljv6i.fsf@localhost
If you are familiar with iCalendar spec, may you look through the
ox-icalendar code and check other places where we do not conform to the
newline spec?
Ideally, we want a set of private functions ensuring proper prescribed
format for all the used iCalendar syntax entries. Otherwise, we will
keep forgetting about these subtleties.
> +(defun org-icalendar--rrule (unit value)
> + (format "RRULE:FREQ=%s;INTERVAL=%d\n"
\r\n
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>