From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: Re: Diary synchronising with Google calendar Date: Wed, 07 Jul 2010 23:20:14 +0100 Message-ID: <8739vv6ijl.wl%ucecesf@ucl.ac.uk> References: <19508.61256.794705.331948@gargle.gargle.HOWL> Reply-To: Eric S Fraga Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/mixed; boundary="Multipart_Wed_Jul__7_23:20:14_2010-1" Return-path: Received: from [140.186.70.92] (port=56612 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OWcyZ-0001KH-M2 for Emacs-orgmode@gnu.org; Wed, 07 Jul 2010 18:20:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OWcyY-00049t-8k for Emacs-orgmode@gnu.org; Wed, 07 Jul 2010 18:20:19 -0400 Received: from vscane-c.ucl.ac.uk ([144.82.108.43]:52190) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWcyY-00049o-2f for Emacs-orgmode@gnu.org; Wed, 07 Jul 2010 18:20:18 -0400 In-Reply-To: <19508.61256.794705.331948@gargle.gargle.HOWL> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Jordi Inglada Cc: Emacs-orgmode@gnu.org --Multipart_Wed_Jul__7_23:20:14_2010-1 Content-Type: text/plain; charset=US-ASCII On Wed, 7 Jul 2010 23:19:04 +0200, Jordi Inglada wrote: > > Hi Eric, > > I am sorry to ask this, but can you post detailed instructions on how > to use your code? It seems that I am (at least) missing the > "add-to-google-calendar" function. > > Thanks. > > Jordi Jordi, the original email had the emacs lisp defadvice function (see below) as well as the activation of that function. The advice is called "add-to-google-calendar". All you have to do is execute both bits, not just the last line as the last line assumes you have defined the advice already. I hope that makes sense? eric #+begin_src emacs-lisp (defadvice org-agenda-add-entry-to-org-agenda-diary-file (after add-to-google-calendar) "Add a new Google calendar entry that mirrors the diary entry just created by org-mode." (let ((type (ad-get-arg 0)) (text (ad-get-arg 1)) (d1 (ad-get-arg 2)) (year1 (nth 2 d1)) (month1 (car d1)) (day1 (nth 1 d1)) (d2 (ad-get-arg 3)) entry dates) (if (or (not (eq type 'block)) (not d2)) (setq dates (format "%d-%02d-%02d" year1 month1 day1)) (let ((year2 (nth 2 d2)) (month2 (car d2)) (day2 (nth 1 d2)) (repeats (- (calendar-absolute-from-gregorian d1) (calendar-absolute-from-gregorian d2)))) (if (> repeats 0) (setq dates (format "%d-%02d-%02d every day for %d days" year1 month1 day1 (abs repeats))) (setq dates (format "%d-%02d-%02d every day for %d days" year1 month1 day1 (abs repeats)))) )) (setq entry (format "/usr/bin/google calendar add --cal org \"%s on %s\"" text dates)) ;;(message entry) (if (not (string= "MYLAPTOPCOMPUTER" mail-host-address)) (shell-command entry) (let ((offline "~/tmp/org2google-offline-entries")) (find-file offline) (goto-char (point-max)) (insert (concat entry "\n")) (save-buffer) (kill-buffer (current-buffer)) (message "Plain text written to %s" offline))))) (ad-activate 'org-agenda-add-entry-to-org-agenda-diary-file) #end_src --Multipart_Wed_Jul__7_23:20:14_2010-1 Content-Type: text/plain; charset=US-ASCII -- Eric S Fraga GnuPG: 8F5C 279D 3907 E14A 5C29 570D C891 93D8 FFFC F67D --Multipart_Wed_Jul__7_23:20:14_2010-1 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --Multipart_Wed_Jul__7_23:20:14_2010-1--