Jack Baty: CalDAV to my Emacs Diary

Wait 5 sec.

Please, there must be a thousand ways to do this that I haven’t discovered. If you know of anything simpler, I’m all ears. The following is a quick-and-dirty summary of how I did it.I use the Emacs Diary all the time. I prefer it to using only Org-mode dates in my agenda. The tricky piece is getting the stuff from my CalDAV (Fastmail) calendar into the diary.Hanno’s post, Managing calendar events in Emacs got me started. Their post is more geared toward Org dates, but it gave me a good leg up.Basically, it’s this:Sync using vdirsyncerConvert using khalInclude converted entries in my diary fileI installed vdirsyncer and khal via Pacman (Omarchy)Here’s my ~/.config/vdirsyncer/config:[general]# A folder where vdirsyncer can store some metadata about each pair.status_path = "~/.vdirsyncer/status/"# CALDAV[pair jack_calendar]a = "jack_calendar_local"b = "jack_calendar_remote"collections = ["from a", "from b"]# Calendars also have a color propertymetadata = ["displayname", "color"][storage jack_calendar_local]type = "filesystem"path = "~/.calendars/"fileext = ".ics"[storage jack_calendar_remote]type = "caldav"url = "https://my.caldav.account"username = "nerd@example.com"password = "averylongpasswordreally"I ran vdirsyncer discover once and then vdirsyncer sync and it pulled my calendars down into ~/.calendars/vdirsyncer creates .ics calendar files, which aren’t useful for Emacs Diary. That’s where khal comes in.My ~/.config/khal/config file:[calendars][[main]] path = "~/.calendars/699f44f9-799a-4325-9328-aff622023096/" color = dark green[[other]] path = "~/.calendars/2e7d0c52-d5c7-4e6a-aa2e-01f8eb84a515/"[locale] dateformat = %Y-%m-%d timeformat = %H:%MThat tells khal where the calenders are, and sets up a usable output format for use in the Emacs Diary. The following command is where I landed.khal list --format "{start-date} {start-time}-{end-time} {title}" \ --day-format "" \ today 10d >~/.config/emacs-mine/caldav-diaryIt generates a list of calendar events from today until 10 days from now and puts the results into a file that I use as part of my Emacs Diary. Just make sure that includes are enabled:(add-hook 'diary-list-entries-hook 'diary-include-other-diary-files)Then, in my main diary files, I added the include line:#include "/home/jbaty/.config/emacs-mine/caldav-diary" Events from CalDAV on my Org agenda And boom! My Fastmail calendar shows up in my Org Agenda.I’m not worrying about syncing the other direction, yet.