Complete Computing Environment: Google Calendar

Table of Contents

Getting Org-mode scheduled events from Google Calendar

org-gcal1 lets you pull Google Calendar data in to and out of Org-mode. I used org-caldav for the longest time, but this seems like it is more featureful and reliable than that, so we're going to try this for a while. Make sure you follow the directions, it relies on creating a Google developer account and supplying a client id and client secret which you can use to OAuth with.

(provide 'cce-gcal)
(install-pkgs '(org-gcal))

I only use my work calendars right now for this, and I keep the values in the Customize system to keep them out of Git.

(setq org-gcal-auto-archive t)
(setq org-gcal-down-days 30)
(setq org-gcal-up-days 30)

org-gcal uses the calendar's timezone by default, this makes sure those end up in UTC.

(defun cce/clean-up-gcal-timestamps ()
  (dolist (cal-cons org-gcal-file-alist)
    (let ((filename (cdr cal-cons)))
      (shell-command (format "python ~/org/ --from Etc/GMT+8 --to UTC --file %s"
      (with-current-buffer (find-file-noselect filename t)
        (revert-buffer t t)
        (insert "#+FILETAGS: WORK\n")

(defun cce/gcal-fix-bad-events ()
  (when (re-search-forward "[a-zA-Z0-9 ]+\\*" nil t)
    (backward-char 1)
    (insert "\n")

Getting Org-mode scheduled events from Facebook and Meetup

(defun cce/fetch-private-calendars ()
    (async-shell-command "awk -f ~/org/ical2org.awk <(curl '') >" (get-buffer-create " *meetup fetch*")))
    (async-shell-command "awk -f ~/org/ical2org.awk <(curl '') >" (get-buffer-create " *fb fetch*"))))


Author: Ryan Rix

Created: 2018-04-11 Wed 11:53

Validate XHTML 1.0