Exporting Diary Entries to iCalendar
The following commands will export diary entries in iCalendar format:
diary-icalendar-export-file
Exports a diary file to iCalendar format.
diary-icalendar-export-region
Exports a region of diary text to iCalendar format.
iCalendar export depends on a number of user-customizable variables, which are in the diary-icalendar-export customization group. You can review and customize these variables with M-x customize-group. See Customization Groups.
Exporting diary entries to iCalendar requires you to respect certain conventions in your diary, so that iCalendar properties can be parsed from your diary entries.
By default, the exporter will use the first line of the entry (after the date and time) as the iCalendar summary and the rest of the entry as its iCalendar description. Other iCalendar properties can also be encoded in the entry on separate lines, like this:
2025/11/11 Bender's birthday bash
Location: Robot House
Attendees:
Fry <philip.fry@mars.edu>
Günter <guenter@mars.edu>This format matches the format produced by the default import functions.
If you customize the import format, or you want to export diary entries in a different format, you will need to customize the export variables to detect the format of your diary entries. The most common iCalendar properties are parsed from diary entries using regular expressions. See the variables named diary-icalendar-*-regexp in the diary-icalendar-export customization group to modify how these properties are parsed.
If you need to export other iCalendar properties, or do more complicated parsing, you can define a function to do so and set it as the value of the variable diary-icalendar-other-properties-parser; see its docstring for details.
By default, the exporter assumes that each diary entry represents a single iCalendar event. If you like to keep your diary in a one-entry-per-day format, with different events on continuation lines within the same entry, you can still export such entries as distinct iCalendar events. To do this, set the variable diary-icalendar-export-linewise to a non-nil value.
For example, after setting this variable, an entry like:
2025-05-03
9AM Lab meeting
Günter to present on new assay
Start experiment A
12:30-1:30PM Lunch with Phil
16:00 Experiment A finishes; move to freezerwill be exported as four events, each on the same day, but with different start times (except for the second event, “Start experiment A”, which has no start time). See the docstring of diary-icalendar-export-linewise for more information.