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