** Feature
** Requirements [[https://github.com/tkf/emacs-request][emacs/request]]
** Install
Enable google calendar api and generator api credential. [[https://support.google.com/googleapi/answer/6158849?hl=en&ref_topic=7013279][How to enable google calendar api]]
Install emacs/request by emacs command `package-install'.
Run package-install, then enter request, then enter
Clone org-sgcal source code into your .emacs directory. git clone https://github.com/pooruse/org-sgcal.git
Add it to load-path add command below into init.el (add-to-list 'load-path "~/.emacs.d/usr/org-sgcal") Here I clone org-sgcal into ~/.emacs.d/usr/
Import package by (require 'org-sgcal) add (require 'org-sgcal) after command in previous step
** Quick Start Create an empty org file. Insert contents below
api projector title (any name is OK) :PROPERTIES: :CLIENT-ID: your-google-api-client-id :CLIENT-SECRET: your-google-api-client-secret :END: ** calendar name (any name is OK) :PROPERTIES: :CLIENT-ID: your-google-api-client-id :CLIENT-SECRET: your-google-api-client-secret :COLOR-ID: (TODO 0 DONE 1) (optional property) :END:
run org-sgcal-fetch-all will fetch events from your calendar then you can use org-sgcal-post-at-point or org-sgcal-delete-at-point to modify events.
or use org-sgcal-update-by-tag to update or delete events with tag UPDATE or DELETE
I recommand you add #+TAGS: UPDATE(u) DELETE(d) in the beginning of org file.
** How to use the property, COLOR-ID You can learn something from [[https://eduardopereira.pt/2012/06/google-calendar-api-v3-set-color-color-chart/][this blog]], google calendar api provide 11 colors by id. You can choose it by integer from 1 to 11. (0 is calendar color depends on your calendar setting) sgcal will choose the color from COLOR-ID property according to todo-keyword.
*** format Value of COLOR-ID is an elisp plist, for example, If we have COLOR-ID with (TODO 5 DONE 6), org-sgcal will set color-id=5 when you intend to post an event with TODO todo-keyword. And set color-id=6 when todo-keyword is DONE.
** custommer varriables
*** org-sgcal-timezone This variable will effect the time zone settings in command org-sgcal-post-event. Default value is Asia/Taipei
org-sgcal-up-days org-sgcal-down-days this two variable will effect the time range of org-sgcal-fetch-all. In default setting, org-sgcal will fetch from 60 day before now to 30 day after now. * Bugs When google api oath2 token is expired, emacs requests will show "error in process filter: url-http-parse-headers: Wrong type argument: char-or-string-p, nil" and emacs will be freeze. I set the requests default timeout to 10 seconds. so If your oath2 token is expired. Emacs will be freezed about 10 second then shows "Access token expired, please run org-sgcal-update-tokens again". If you have more than 1 google api project (multi client-id) in one org file. emacs will be freezed more than 10 seconds (number of clinet-id need to dealt with 10 seconds)