reddit / emacs

How do I stop org-icalendar-print-entries making up dates?

-LeopardShark- · 2022-02-23 10:59
When exporting `TODO` items that have no timestamp to iCalendar format, org-mode for some reason [pretends that](https://github.com/tkf/org-mode/blob/c2ebeea6f68f2ef804d387c238e4acccf655dc64/lisp/org-icalendar.el#L555) [the timestamp is today](https://github.com/tkf/org-mode/blob/c2ebeea6f68f2ef804d387c238e4acccf655dc64/lisp/org-icalendar.el#L322). This leaves a big blob of ‘events’ in my calendar for today’s date which is a bit annoying. Is there a way to stop it putting `DTSTAMP` and `DTSTART` entries into the `.ics` files when the item has no date?
-LeopardShark- · 2022-05-08 10:20
Here is a Python script to remove these extra lines as a workaround. #!/usr/bin/env python3 from pathlib import Path from datetime import datetime bad = f"DTSTART:{datetime.now():%Y%m%dT%H%M00}" for f in Path(__file__).parent.glob("*.ics"): lines = f.read_text().splitlines() f.write_text("\r\n".join([line for line in lines if line != bad])) Keep it in the same directory as your `.ics` files and run it after exporting, but before the time changes to the next minute!
yantar92 · 2022-05-08 12:18
That's some kind of ancient Org distribution. Please consult https://orgmode.org to get up-to-date version of Org.
-LeopardShark- · 2022-05-08 14:22
[It still does it with the latest version.](https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/ox-icalendar.el#n737) There's a comment explaining it now, so it seems to be deliberate, but I'm not sure why. Perhaps some `.ics` importers require it.
yantar92 · 2022-05-08 14:56
Seems to be optional according to https://icalendar.org/iCalendar-RFC-5545/3-6-2-to-do-component.html Also, that line stays in the ox-icalendar from the time it was first introduced. I am not sure about the reasoning. Feel free to send an email to Org ML (see https://orgmode.org/manual/Feedback.html)