3

Is there a way to show Apple Calendars in org-mode? All I need is to be able to see them in org-mode, I am not (currently) interested in syncing or anything like that. Ideally, the Apple Calendars should show up as a Readonly buffer (or diary, or whatever the term ends up being).

There is org-mac-iCal, but it is severely out of date and does not work any more. I suppose the way to do it is to parse the Calendar files and put them where org-mode would see them, but I am curious if this is done already by somebody?

n_x_l
  • 161
  • 1
  • 5
  • It looks like org-caldav has recent commit history https://github.com/dengste/org-caldav. icloud calendar supports caldav https://askubuntu.com/questions/911567/how-to-sync-icloud-calendar. – lagzilla Apr 26 '19 at 18:21

2 Answers2

1

Here are the settings I use for diary loaded into org-mode. You need to get urls for the apple calendars you want to show in org.

I found the discussion by Adolfo Villafiorita very helpful.

You'll also probably want to set up some sort of script to automate checking your calendars for new entries. I think the easiest way to do this is to run a script for emacs in batch mode.

(setq diary-file (concat cpm-local-dir "diary-files/diary"))
(setq diary-location (concat cpm-local-dir "diary-files/"))
(setq org-agenda-include-diary t)
(setq diary-display-function 'diary-fancy-display)
(add-hook 'diary-list-entries-hook 'diary-include-other-diary-files)
(add-hook 'diary-list-entries-hook 'diary-sort-entries t)

; calendars you want to download
; each item links to a remote iCal calendar
(setq calendars
      '(("work" . "https://path/to/work/cal")
        ("gcal" . "https://path/to/gcal")
        ("family" . "https://path/to/fam/cal")
        ))

(defun cpm--getcal (url file)
  "Download ics file and add it to file"
  (let ((tmpfile (url-file-local-copy url)))
    (icalendar-import-file tmpfile file)
    (kill-buffer (car (last (split-string tmpfile "/"))))))

(defun cpm/getcals ()
  "Load a set of ics calendars into emacs diary files"
  (interactive)
  (mapcar #'(lambda (x)
              (let ((file (concat diary-location (car x)))
                    (url (cdr x)))
                (message (concat "Loading " url " into " file))
                (find-file file)
                ;; (flush-lines "^[& ]") ;; if you import ical as non marking
                (erase-buffer) ;; to avoid duplicating events
                (cpm--getcal url file)
                ))
          calendars)
   ;; send everything to a diary file
   (shell-command-to-string "cat work family gcal > diary"))

mclear
  • 1,525
  • 9
  • 17
1

Thanks for mentioning org-mac-iCal and I found someone forked and update the repo, here is the new repo link: https://github.com/ndw/org-mac-iCal.

I tested and it worked. Although I don't know why a certain calendar did not show even I specified the name of it.

Yuji
  • 133
  • 8