kidd / org-gcal.el

Org sync with Google Calendar. (active maintained project as of 2019-11-06)
439 stars 47 forks source link

Is there anyway to run fetch async / in the background? #156

Open erikc96 opened 3 years ago

erikc96 commented 3 years ago

I have a few calendars and it takes a while to sync everything back and forth!

I've tried running it using something like (async-start (lambda () (org-gcal-fetch)), but this didn't seem to work!

telotortium commented 3 years ago

With the most recent versions of this package, org-gcal-fetch is itself a function implemented using the deferred.el package (not async - that's a different package unfortunately) that you can wait on the completion of. If you call it interactively, it attempts to run without blocking - unfortunately, this is less than perfect, partially because Emacs will eventually stack overflow if you try to set up a deferred chain of individual fetches for each event. I've worked around the stack overflow problem, but it means that the org-gcal-fetch needs to queue up everything on the main thread before it can return a deferred object to wait on.