From mboxrd@z Thu Jan  1 00:00:00 1970
From: Arun Persaud <apersaud@lbl.gov>
Subject: Re: Status google calendar sync
Date: Fri, 10 Jun 2011 12:09:04 -0700
Message-ID: <4DF26BD0.4000001@lbl.gov>
References: <AANLkTinuPKdCcCLw5vPtv8UD4RHNh7rQ2SNhtE0u0iTn@mail.gmail.com>	<8762t3idd3.fsf@gmx.ch>
	<4D48E887.20900@gmail.com>	<5E7BEB01-1411-4BF4-A36B-C4FF43E55CF6@fastmail.net>	<AANLkTimonL4vzW_PATw1yV7Uq+hfGzpOSmA_imFLRwcu@mail.gmail.com>	<6843D3C6-E3B7-4D31-9F4C-163FA3770D71@fastmail.net>	<t5x39jhhbdd.fsf@rgc.damtp.cam.ac.uk>
	<4DF24E8E.5010200@lbl.gov> <t5xsjrhfsci.fsf@rgc.damtp.cam.ac.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Return-path: <emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org>
Received: from eggs.gnu.org ([140.186.70.92]:51210)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <apersaud@lbl.gov>) id 1QV74w-0002wq-DY
	for emacs-orgmode@gnu.org; Fri, 10 Jun 2011 15:09:12 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <apersaud@lbl.gov>) id 1QV74v-0005Pb-7a
	for emacs-orgmode@gnu.org; Fri, 10 Jun 2011 15:09:10 -0400
Received: from ironport3.lbl.gov ([128.3.41.25]:17087)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <apersaud@lbl.gov>) id 1QV74u-0005P4-OC
	for emacs-orgmode@gnu.org; Fri, 10 Jun 2011 15:09:08 -0400
Received: by mail-px0-f171.google.com with SMTP id 7so1675059pxi.16
	for <emacs-orgmode@gnu.org>; Fri, 10 Jun 2011 12:09:06 -0700 (PDT)
In-Reply-To: <t5xsjrhfsci.fsf@rgc.damtp.cam.ac.uk>
List-Id: "General discussions about Org-mode." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
	<mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: </archive/html/emacs-orgmode>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
	<mailto:emacs-orgmode-request@gnu.org?subject=subscribe>
Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org
Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org
To: emacs-orgmode@gnu.org

Hi

> When going from org -> google, do I need to do anything about using
> org-icalendar-store-UID?  I'd rather not have to populate my org files
> with :ID: entries.

I don't... however, I have to admit that I don't really know that much
about .ics files and the use of UID. The setup at the moment just works
for me and the appointments I want show up in google calendar (only ones
with a start and end time). One issue I still have is that they only
show up in an extra calendar and I have to copy them by hand into my
main calendar (so that other people can see them too)... this is ok for
me, since I don't have too many entries that go from org->google, mostly
I use the other direction google->org.

So there is still lots of room for improvement ;)

Anyway, here is the relevant part from my .emacs file just in case

;;; org -> google export via .ics
(setq org-icalendar-use-UTC-date-time nil)
(setq org-icalendar-timezone "America/Los_Angeles")

(defun org-mycal-export-limit ()
  "Limit the export to items that have a date, time and a range. Also
exclude certain categories."
  (setq org-tst-regexp "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ...
[0-9]\\{2\\}:[0-9]\\{2\\}[^\r\n>]*?\\)>")
  (setq org-tstr-regexp (concat org-tst-regexp "--?-?" org-tst-regexp))
  (save-excursion
    ; get categories
    (setq mycategory (org-get-category))
    ; get start and end of tree
    (org-back-to-heading t)
    (setq mystart    (point))
    (org-end-of-subtree)
    (setq myend      (point))
    (goto-char mystart)
    ; search for timerange
    (setq myresult (re-search-forward org-tstr-regexp myend t))
    ; search for categories to exclude
    (setq mycatp (member mycategory org-export-exclude-category))
    ; return t if ok, nil when not ok
    (if (and myresult (not mycatp)) t nil)))

(defun org-mycal-export ()
  (let ((org-icalendar-verify-function 'org-mycal-export-limit))
    (org-export-icalendar-combine-agenda-files)))

and I export via a cron script doing

emacs --batch -l ~/.emacs  --eval '(defun ask-user-about-lock (file opp)
nil)' -f org-mycal-export

cheers
	ARUN