Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors when the diary file does not exist #3

Open
rpgoldman opened this issue Sep 11, 2022 · 1 comment
Open

Errors when the diary file does not exist #3

rpgoldman opened this issue Sep 11, 2022 · 1 comment

Comments

@rpgoldman
Copy link

On my first try using this, I got an error because I did not have a diary file.

I fixed this by modifying the top of org-mac-iCal as follows:

(defun org-mac-iCal ()
  "Selects checked calendars in iCal.app and imports them into
the the Emacs diary"
  (interactive)

  ;; kill diary buffers then empty diary files to avoid duplicates
  (setq currentBuffer (buffer-name))
  (setq openBuffers (mapcar (function buffer-name) (buffer-list)))
  (omi-kill-diary-buffer openBuffers)
  (with-temp-buffer
    (when (file-exists-p diary-file) ; <------ added this check
     (insert-file-contents diary-file))
    (delete-region (point-min) (point-max))
    (write-region (point-min) (point-max) diary-file))

Hope that's helpful. Seemed too trivial to bother with a full clone and pull request...

@rpgoldman
Copy link
Author

Actually, reading further after fixing this, there seem to be a lot of issues with this, and also some pretty scary practices, like using the ~/Library/Calendars directory in a way that is really only appropriate to a temp directory, and renaming .ics files, instead of copying them. So I am going to fork this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant