[emacs-berlin] Export org mode files to iCalendar format

Tilmann Singer tils at tils.net
Tue Apr 4 14:16:02 UTC 2023


Hi Antonio,

Good question. It took me some time to figure out how to generate the
ics files that are attached to the meetup announcement mails. What works
for me is: set the region to contain all lines of the entry to export,
then run "M-x org-icalendar-export-to-ics RET".

For example with this entry:

--8<---------------cut here---------------start------------->8---
*** March 2022 Emacs Meetup
:PROPERTIES:
:TIMEZONE: Europe/Berlin
:LOCATION: The Internet
:END:
<2022-03-30 Wed 19:00-21:00>
--8<---------------cut here---------------end--------------->8---

this file is generated:

--8<---------------cut here---------------start------------->8---
BEGIN:VCALENDAR
VERSION:2.0
X-WR-CALNAME:emacs
PRODID:-////Emacs with Org mode//EN
X-WR-TIMEZONE:CEST
X-WR-CALDESC:
CALSCALE:GREGORIAN
BEGIN:VEVENT
DTSTAMP:20230404T135957Z
UID:TS1-f1aa8108-0432-4ebe-b17e-3d59900b27fb
DTSTART;TZID=Europe/Berlin:20220330T190000
DTEND;TZID=Europe/Berlin:20220330T210000
SUMMARY:March 2022 Emacs Meetup
LOCATION:The Internet
DESCRIPTION:<2022-03-30 Wed 19:00>–<2022-03-30 Wed 21:00>
CATEGORIES:emacs
END:VEVENT
END:VCALENDAR
--8<---------------cut here---------------end--------------->8---

Not sure why it has mixed kinds of line endings. Also it would be nicer
if the DESCRIPTION wouldn't include the org formatted timestamps - oh
well. The TIMEZONE property was necessary at some point, but I can't
remember why. I've added LOCATION in this test, apparently it is
exported as well.

The same entry exported with "C-c C-e C-s c f" produces this, which
looks very different from your example – even less useful:

--8<---------------cut here---------------start------------->8---
BEGIN:VCALENDAR
VERSION:2.0
X-WR-CALNAME:emacs
PRODID:-////Emacs with Org mode//EN
X-WR-TIMEZONE:CEST
X-WR-CALDESC:March 2022 Emacs Meetup
CALSCALE:GREGORIAN
END:VCALENDAR
--8<---------------cut here---------------end--------------->8---

You didn't say that you are limiting to the subtree, so you exported a
whole org file I suppose?

I would have expected that exporting a subtree produces a complete ics
file, but apparently it only works when setting the region. I wonder if
this is some misunderstanding on my part how the calendar export works,
or an oversight.

Oh, and now that I write this I found out that setting the region and
then calling "C-c C-e c f" has the desired effect of only exporting the
entry in the region as well. That's a bit more convenient.


cheers, Til
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 507 bytes
Desc: not available
URL: <http://mailb.org/pipermail/emacs-berlin/attachments/20230404/49bf7aaf/attachment.sig>


More information about the emacs-berlin mailing list