Skip to content
Org sync with Google Calendar. (active maintained project as of 2019-11-06)
Emacs Lisp Makefile
Branch: master
Clone or download
This branch is 123 commits ahead of myuhe:master.

Latest commit

Latest commit 6821e34 Nov 8, 2019

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Add Makefile targets for running tests Oct 7, 2019
Makefile test-org-gcal => org-gcal-test Oct 7, 2019
README.ja.org Initial commit Jan 3, 2014
README.org Expand org-gcal README Nov 8, 2019
emacs.png Fix #9 Apr 6, 2014
org-gcal-test.el
org-gcal.el Fix typo in permission statement Oct 17, 2019
org.png Fix #9 Apr 6, 2014

README.org

Org-Gcal http://melpa.org/packages/org-gcal-badge.svg

org-gcal offers

  • Fetch google calendar event
  • Post/edit org element
  • Sync between Org and Gcal

Data will be UTF-8 encoded for sync.

Getting Started

Follow the instructions at Installation, and then run org-gcal-fetch to download Google Calendar events into your Org-mode files using the Google Calendar API. Run org-gcal-fetch to retrieve new events and update events already retrieved, and run org-gcal-post-at-point on an Org-mode headline corresponding to a downloaded event to push updates to the events on the Google Calendar API server.

Requirements

  • tkf/emacs-request
  • jwiegley/alert

    org-gcal is now available in the famous emacs package repo MELPA, so the recommended way is to install it through Emacs package management system.

Installation

  1. Go to Google Developers Console
  2. Create a project (with any name)
  3. Click on the project
  4. Click on APIs & Services then Credentials
  5. Click on Create Credentials and Oauth client ID with Application type Installed application, Installed application type Other
  6. Click on Create Client ID
  7. Record the Client ID and Client secret for setup.
  8. Under the same APIs & Services menu section, select Library
  9. Scroll down to Calendar API. Click the Enable button to enable calendar API access to the app you created in steps 5 & 6.

    Go to Google setting page to check the calendar ID.

  10. Go to Google setting page and click the gear-shaped settings icon in the upper right, then select “Settings” from the drop down list.
  11. Select the “Setting for my Calendars” tab on the left, which will display a list of your calendars.
  12. Select the calendar you would like to synchronize with. This will take you to the “Calendar Settings” page for that calendar. Near the end is a section titled “Integrate Calendar”. Following the XML, ICAL, and HTML tags, you will see your Calendar ID.
  13. Copy the Calendar ID for use in the settings below, where you will use it as the first element in the org-gcal-file-alist for associating calendars with specific org files. You can associate different calendars with different org files, so repeat this for each calendar you want to use.

Setting example

(require 'org-gcal)
(setq org-gcal-client-id "your-id-foo.apps.googleusercontent.com"
      org-gcal-client-secret "your-secret"
      org-gcal-file-alist '(("your-mail@gmail.com" .  "~/schedule.org")
                            ("another-mail@gmail.com" .  "~/task.org")))

Multiple accounts

There’s no support for multiple accounts. If you want to use org-gcal with calendars from different accounts, you can give permissions to the account you configured via the calendar’s settings interface.

To get more detailed information you can check this link.

Testing

To execute compile and regression tests, run make.

This will use your existing Emacs installation to generate a value of load-path that allows org-gcal to find all its dependencies, and save it to .load-path.el in this directory. To delete this and other temporary files, run make clean.

Usage

Event structure

org-gcal modifies the following Org-mode properties and drawers when updating an event from the Google Calendar API:

Title
contains the event summary (minus any TODO keywords or tags).
  • Timestamps:
    SCHEDULED
    if the SCHEDULED attribute of a headline is present, org-gcal will maintain the start and end times of an event there rather than in a timestamp in the org-gcal drawer (see below).
  • Properties:
    • calendar-id (can be modified using the =org-gcal-calendar-id-property= variable) :: contains the calendar ID of the calendar on which the event is maintained.
    • ETag (can be modified using the =org-gcal-etag-property= variable) :: contains the most recent ETag retrieved from the Google Calendar API for the event (see the Google Calendar API documentation). Used to support automatically updating the headline using the most recent event data from the API if it has changed on the server since it was last retrieved.
    ID
    contains <event_id>/<calendar_id> of the event, as provided by the Google Calendar API. Don’t change the ID manually, or else the event won’t be able to retrieved or updated from the headline.
  • Drawers:
    org-gcal (can be modified using the =org-gcal-drawer-name= variable)
    contains the event description. Unless the timestamp is maintained using SCHEDULED, the initial line of this drawer contains the event start and end time, with the event description starting in the next paragraph.

Apart from these, all other attributes are preserved when an event is updated in any way.

Commands

org-gcal-fetch

Fetch Google calendar events for all calendar IDs in org-gcal-file-alist occurring between org-gcal-up-days before today and org-gcal-down-days after today. If the events have already been retrieved and can be located using their Org-mode headline IDs, update the event in place. Otherwise, insert it at the end of the file corresponding to the event’s calendar ID in org-gcal-file-alist. Does not update events on the server.

org-gcal-sync

Like org-gcal-fetch, but also update events on the server if they have changed locally.

org-gcal-fetch-buffer

Fetch changes to Google calendar events to update entries in the current buffer, but don’t update events on server.

org-gcal-sync-buffer

Sync entries in the current buffer with Google Calendar.

org-gcal-post-at-point

Update the event represented by the Org-mode headline at POINT on the server using the Google Calendar API.

If the event has changed on the server since it was last retrieved (detected using the ETag property), automatically update the headline using the event data from the server instead of updating the event on the server.

org-gcal-delete-at-point

Delete the event represented by the Org-mode headline at POINT on the server using the Google Calendar API. This will not delete the Org-mode headline.

If the event has changed on the server since it was last retrieved (detected using the ETag property), automatically update the headline using the event data from the server instead of updating the event on the server.

org-gcal-refresh-token

Refresh the OAuth token. OAuth token expired in 3600 seconds, You should refresh token on a regular basis.

Other features

Minimize alerts

Modify org-gcal-notify-p from t to nil

Errors

Duplicate ID

You get an error like this:

Duplicate ID "FOO", also in file BAR

Most likely, this means some calendar events were mistakenly retrieved twice (for example, if you ran org-gcal-fetch on different computers). Search your Org-mode files for the duplicate ID “FOO” and delete one of the headlines with duplicate IDs (or just change the ID property on one of the events to something else).

Similar applications

dengste/org-caldav

You can’t perform that action at this time.