Emacs is subsuming me! I have managed to get email up and runningusing mu4e and rss using elfeed and image viewing withimage-dired

Next up is some form of calendar integration!

Although I use Google Calendar I don’t rely on any google appsdirectly; an android app called Simple Calendar is adequate for myneeds and enables the thing I cherish most of all (except emacs ofcourse!) and that is the ability to produce an offline copy. It canexport to an ics file, and I have developed a habit of exporting toan offline file every time I update my calendar. This means that Ihave some exported calendar files lying around, including of coursethe most recent one.

Initially I attempted to use org-gcal which potentially enables atwo way communication with Google Calendar through their API, but Igot lost in the setup and of course this is Google, at some stage itis likely they will either change their API / remove it / or chargefor it.

Anyway, do I really need to modify my calendar from within emacs?, Iam quite comfortable using Simple Calendar on my phone and if Ireally need to add calendar entries from my laptop then I always haveThunderbird as a backup.

So I may just be in a very fortunate position regarding an adequatelevel of emacs calendar integration :

  1. I only require read only
  2. I have an up-to-date ics file available

I created the following function which opens up a nicely formattedcalendar using the packages calfw and calfw-cal (and they didn’trequire any additional setup).

(defun my/calendar () (interactive) (setq tmp-file (concat home-dir "/DCIM/Backup/tmp.org")) (delete-file tmp-file) (when (get-buffer (file-name-nondirectory tmp-file)) (kill-buffer (file-name-nondirectory tmp-file))) (setq last-ics (car (directory-files (concat home-dir "/DCIM/Backup") 'full "\.ics$" #'file-newer-than-file-p))) (icalendar-import-file last-ics tmp-file) (cfw:open-diary-calendar) (cfw:open-diary-calendar) (when (get-buffer (file-name-nondirectory last-ics)) (kill-buffer (file-name-nondirectory last-ics))))

and produces a calendar of the form:

I could import everything directly into my diary-file but I decidedto be a little more flexible and potentially allow for multiplecalendars by setting an include directive in my diary file as thus:

#include "~/DCIM/Backup/tmp.org"

The key to the my/calendar function is to pull in the most recentics file and call the built in icalendar-import-file to convert /import the ics data into my diary file. The cfw packages willthen take care of the rest. The other parts of the function are justtidying up various buffers and files to make things a little cleaner.

One little wrinkle I discovered and didn’t necessary solve to asatisfactory level was when I first call up cfw:open-diary-calendarthe calendar didn’t resize correctly to fit the window, a second callhowever seemed to fix this and with no overhead.

One final addition was the following:

(add-to-list 'display-buffer-alist `(,(rx(or "Calendar")) display-buffer-in-direction (direction . right) (dedicated . t) (window . root) (window-width . 80)))

Which gives me greater control of where the calendar window is opened