From: Eric S Fraga <ucecesf@ucl.ac.uk>
To: Jordi Inglada <jordi.inglada@cesbio.cnes.fr>
Cc: Emacs-orgmode@gnu.org
Subject: Re: Diary synchronising with Google calendar
Date: Wed, 07 Jul 2010 23:20:14 +0100 [thread overview]
Message-ID: <8739vv6ijl.wl%ucecesf@ucl.ac.uk> (raw)
In-Reply-To: <19508.61256.794705.331948@gargle.gargle.HOWL>
[-- Attachment #1: Type: text/plain, Size: 1990 bytes --]
On Wed, 7 Jul 2010 23:19:04 +0200, Jordi Inglada <jordi.inglada@cesbio.cnes.fr> 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
[-- Attachment #2: Type: text/plain, Size: 75 bytes --]
--
Eric S Fraga
GnuPG: 8F5C 279D 3907 E14A 5C29 570D C891 93D8 FFFC F67D
[-- Attachment #3: Type: text/plain, Size: 201 bytes --]
_______________________________________________
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
next prev parent reply other threads:[~2010-07-07 22:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-07 21:19 Diary synchronising with Google calendar Jordi Inglada
2010-07-07 22:20 ` Eric S Fraga [this message]
[not found] ` <25098780.22494.1278541157993.JavaMail.root@zm-cesbio-01>
[not found] ` <19511.31257.267848.353668@gargle.gargle.HOWL>
2010-07-09 20:28 ` Eric S Fraga
[not found] ` <18737865.23968.1278707659240.JavaMail.root@zm-cesbio-01>
[not found] ` <19512.6390.427253.455577@gargle.gargle.HOWL>
2010-07-10 22:10 ` Eric S Fraga
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8739vv6ijl.wl%ucecesf@ucl.ac.uk \
--to=ucecesf@ucl.ac.uk \
--cc=Emacs-orgmode@gnu.org \
--cc=e.fraga@ucl.ac.uk \
--cc=jordi.inglada@cesbio.cnes.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.