Re: [Orgmode] Adding entries to Google calendar

2010-09-09 Thread Sven Bretfeld
Hi Matt

Matt Price mopto...@gmail.com writes:

 Sven says something about using org-remember to do the same work --
 it's not clear to me whether you have that working, Sven.  In any case
 would it be difficult to use org-capture instead of the diary?  That
 would certainly be better for my workflow, since i'm not in my
 calendar view very often (htough i suppose if i'm making an
 appointment maybe i ought to be. 

No, I don't. It is indeed possible to add an advice to
org-remember-finalize and I think this could be the right point to start
from. But we have to find a way to parse the data from the
remember-buffer. Eric's approach is different, because he uses variables
that do only occur when using the agenda to diary method. However, I
fear that my abilities are to weak for that. I cannot really read and
understand complex Lisp packages like org-remember.el or org-capture.el.

Greetings,

Sven

___
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


Re: [Orgmode] Adding entries to Google calendar

2010-09-08 Thread Sven Bretfeld
Hi Eric

Eric S Fraga ucec...@ucl.ac.uk writes:

 Alas, there seems no description of the possible syntactical variants
 available on the web. 

 Yes, Google do not appear to be very forthcoming with their parsing
 algorithms.  I had to do a lot of trial and error, especially to
 support block entries, and I think the result is fragile at best.

So far it works with the language of GoogleCalendar set to US English.

   2. We have to isolate the time of day from the diary-entry as a
  further variable (not as part of the variable text), so that
  Germans can format the command correctly. Can you help me with
  that?

 I this moment (swamped with a project application), all I can suggest
 is you look at org's time parsing codes for handling new agenda
 entries.  The text must be parsed somewhere...  If you use the same
 code within the advice, you should be able to pick off the times.

 I'll add this to my todo list but I won't get a chance to play anytime
 soon unfortunately.

Yes, I see. Same for me. I think we can live with this workaround for the
moment. Probably (hopefully), GoogleCL will be developped in a way more
suited in the near future. Until that happens, we can suggest people to
use an English setting of GoogleCalendar. Most org users will probably
use Google as a secondary method anyway.

 That's also my work flow, except of using org-remember k-r instead of
 i. I like to have everything in one org-file. But I can get used to
 keep my appointments in a separate diary file. I can refile them to the
 appropriate places during the weekly review which, then, ends with the
 upload of a new ics file.

 Can the diary file not be your all-in-one org file?

As far as I see, the entries created by the diary method can't be
configured according to level and exact location within the diary.org
file. The entries are written in a tree structure beginning with the
year at the beginning of the file. This would spoil the organization
structure of my main org file.

Thanks very much for your help,

Sven

___
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


Re: [Orgmode] Adding entries to Google calendar

2010-09-08 Thread Matt Price
Hi Erik et cal,

After having put it off for a ocuple of months finally trying to set this
up.  I have both halves of Erik's code working now -- the ical2org that
syncs from google, and the elisp wrapper on googlecl that syncs from org
(see http://osdir.com/ml/emacs-orgmode-gnu/2010-07/msg00265.html and
http://osdir.com/ml/emacs-orgmode-gnu/2010-07/msg00353.html).   I'm still
having a couple of little workability issues, that I think people on this
list have likely already solved, so if I may, briefly:

- as I understand it this system will only work with entries that have been
added via i in a calendar-mode org agenda view.  When I try to add items
this way I am never prompted for a time, only a date.  Am I missing
something here?

- Sven says something about using org-remember to do the same work -- it's
not clear to me whether you have that working, Sven.  In any case would it
be difficult to use org-capture instead of the diary?  That would certainly
be better for my workflow, since i'm not in my calendar view very often
(htough i suppose if i'm making an appointment maybe i ought to be.

I really appreciate the help -- my time management is severely remedial and
I really would like org-mode ot be the tool that fixes that for me.  Best,
Matt
___
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


Re: [Orgmode] Adding entries to Google calendar

2010-09-08 Thread Matt Price
On Wed, Sep 8, 2010 at 11:34 AM, Matt Price mopto...@gmail.com wrote:



 - Sven says something about using org-remember to do the same work -- it's
 not clear to me whether you have that working, Sven.  In any case would it
 be difficult to use org-capture instead of the diary?  That would certainly
 be better for my workflow, since i'm not in my calendar view very often
 (htough i suppose if i'm making an appointment maybe i ought to be.


so, having looked at the code a little more closely, I guess my question is,
can erik's defadvice be converted somehow into a hook that gets executed at
the end of an  org-capture event, provided that the org-capture template is
suitably set up?  I don't really understand how defadvice works, and where,
for instance, ad-get-arg gets its arguments from (so that the relevant
calendar fields can be defined properly).

Matt



___
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


Re: [Orgmode] Adding entries to Google calendar

2010-09-05 Thread Eric S Fraga
On 4 Sep 2010 21:49:25 +0200, Sven Bretfeld sven.bretf...@gmx.ch wrote:
 
 Hi Eric
 
 Eric S Fraga ucec...@ucl.ac.uk writes:
 
  I'm not sure what you mean about complete.  It requires you to have
  installed the Google command line tools (googlecl from Google Code).
  However, this emacs lisp code is not what I would call full-featured
  ;-)
 
 There were several problems, most of which I have solved by now. First,
 I didn't set org-agenda-diary-file. So, calling i from an agenda-view
 merely opened the default diary file. That's why I wondered when
 exactly the advice comes into play. (Therefore I suspected the code to
 be possibly incomplete -- sorry, my fault.)

ah!  yes, the code is complete but the instructions are not.

 Now, the principle procedure works. Entries show up in Google after I
 added them with org-agenda-diary-entry. 
 
 There is one thing left. You have structured the shell-command according
 to the American GoogleCL syntax. That's not working with the German
 locale. For a German GoogleCalendar the only syntax I found working is:

[...]

 Alas, there seems no description of the possible syntactical variants
 available on the web. 

Yes, Google do not appear to be very forthcoming with their parsing
algorithms.  I had to do a lot of trial and error, especially to
support block entries, and I think the result is fragile at best.

 So I did try-and-error: with and without the am
 and um, with the English on, with ISO formated dates etc etc. Except
 the above structure 'text am date um time' no combination works.
 
 I fear, there are only two solutions:
 
   1. As a workaround I have set my GoogleCalendar to the American
  locale. With that everything works fine.
 
   2. We have to isolate the time of day from the diary-entry as a
  further variable (not as part of the variable text), so that
  Germans can format the command correctly. Can you help me with
  that?

I this moment (swamped with a project application), all I can suggest
is you look at org's time parsing codes for handling new agenda
entries.  The text must be parsed somewhere...  If you use the same
code within the advice, you should be able to pick off the times.

I'll add this to my todo list but I won't get a chance to play anytime
soon unfortunately.

  However, the mechanism is there to support hooking into capture
  specifically and possibly into org-time-stamp or org-schedule, say. 
 
 I have tried to work out an advice to org-time-stamp and/or
 org-remember-finish today. But my Lisp is too weak. I couldn't figure
 out how to grab the data.

Maybe post what you did to this list and somebody might be able to
help?

  I don't use Google calendar for scheduled tasks or deadlines so the
  latter don't matter to me; I use it for appointments and my work flow
  is that I always bring up the agenda view to see if my time is free
  before making the appointment.
 
 That's also my work flow, except of using org-remember k-r instead of
 i. I like to have everything in one org-file. But I can get used to
 keep my appointments in a separate diary file. I can refile them to the
 appropriate places during the weekly review which, then, ends with the
 upload of a new ics file.

Can the diary file not be your all-in-one org file?
-- 
Eric S Fraga
GnuPG: 8F5C 279D 3907 E14A 5C29  570D C891 93D8 FFFC F67D
___
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


[Orgmode] Adding entries to Google calendar

2010-09-04 Thread Sven Bretfeld
Hi to all

I try to automatically add newly created dates to GoogleCalendar via
GoogleCL. I have tried Eric Fraga's code from:

http://osdir.com/ml/emacs-orgmode-gnu/2010-07/msg00265.html

but I can't get it to work, nor do I understand it (is it complete?).
Anyway, his approach depends on adding org-entries to diary. So, as far
as I understand it, you have to create new schedules in a rather special
way. Most people, I think, use remember, org-capture or insert new dates
directly into an org file.

What I (and probably others) need is a way to trigger a call of 'google
calendar add' as soon as a new date is created by org-remember etc. What
would be the best way to do this?

Up to now, although a full syncing orgmode with GoogleCalendar is not
possible, we are quite close to it thanks to Eric's '2x2 method' and his
awk-script solution. But that solves only three quarters of the problem.
Informing GoogleCalendar about dates one has created with org still
needs the awkward manual import of ics-files via a web-browser. I think
there could be a better solution.

Greetings,

Sven

___
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


Re: [Orgmode] Adding entries to Google calendar

2010-09-04 Thread Eric S Fraga
On 4 Sep 2010 16:21:08 +0200, Sven Bretfeld sven.bretf...@gmx.ch wrote:
 
 Hi to all
 
 I try to automatically add newly created dates to GoogleCalendar via
 GoogleCL. I have tried Eric Fraga's code from:
 
 http://osdir.com/ml/emacs-orgmode-gnu/2010-07/msg00265.html
 
 but I can't get it to work, nor do I understand it (is it complete?).

I'm not sure what you mean about complete.  It requires you to have
installed the Google command line tools (googlecl from Google Code).
However, this emacs lisp code is not what I would call full-featured
;-)

In any case, what happens when you try to get it to work?  The Google
command line tools are /fragile/, to say the least, but they do sort
of work.  What happens if you type

  google calendar list

at the command line?  Do the entries in your main Google calendar
appear as output?

What happens if you type in something like

  google calendar add Do something interesting at 3pm tomorrow

(or similar)?  You have to get these working before the emacs lisp
code I posted will have a chance of working.

Next, the emacs lisp code I posted assumes that you will have created
a Google calendar called org (to make it easy to clean up without
affecting your main Google calendar).  This has to be done via
google's calendar web interface directly (link for add below My
calendars).  After that, you should be able to say things like

  google calendar list --cal org
  google calendar add --cal org Do something really exciting at 9pm

I hope this helps.

 Anyway, his approach depends on adding org-entries to diary. So, as far
 as I understand it, you have to create new schedules in a rather special
 way. Most people, I think, use remember, org-capture or insert new dates
 directly into an org file.

yes, it is definitely limited in this sense: only entries added via
the org-agenda-diary-entry interface can be added.  However, the
mechanism is there to support hooking into capture specifically and
possibly into org-time-stamp or org-schedule, say.  I don't use Google
calendar for scheduled tasks or deadlines so the latter don't matter
to me; I use it for appointments and my work flow is that I always
bring up the agenda view to see if my time is free before making the
appointment.

 What I (and probably others) need is a way to trigger a call of 'google
 calendar add' as soon as a new date is created by org-remember etc. What
 would be the best way to do this?

I'll let others answer this as I will get it wrong (I had been about
to suggest some form of org-post-capture-hook but there doesn't seem
to be any such variable...).

However, all you need to do is extract the information you want to
pass to google calendar and then execute the particular command.

 Up to now, although a full syncing orgmode with GoogleCalendar is not
 possible, we are quite close to it thanks to Eric's '2x2 method' and his
 awk-script solution. But that solves only three quarters of the
 problem.

Yes, I agree completely.  We're not really close, particularly because
you can't inform either org or google about deletions made in the
other.  Adding in either with links to the other works okay but the
inverse is not possible.

 Informing GoogleCalendar about dates one has created with org still
 needs the awkward manual import of ics-files via a web-browser. I think
 there could be a better solution.

Well, no, not if you can get the google command line scripts working.

Let me know how you get on.

eric
-- 
Eric S Fraga
GnuPG: 8F5C 279D 3907 E14A 5C29  570D C891 93D8 FFFC F67D
___
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


Re: [Orgmode] Adding entries to Google calendar

2010-09-04 Thread Sven Bretfeld
Hi Eric

Eric S Fraga ucec...@ucl.ac.uk writes:

 I'm not sure what you mean about complete.  It requires you to have
 installed the Google command line tools (googlecl from Google Code).
 However, this emacs lisp code is not what I would call full-featured
 ;-)

There were several problems, most of which I have solved by now. First,
I didn't set org-agenda-diary-file. So, calling i from an agenda-view
merely opened the default diary file. That's why I wondered when
exactly the advice comes into play. (Therefore I suspected the code to
be possibly incomplete -- sorry, my fault.)

Now, the principle procedure works. Entries show up in Google after I
added them with org-agenda-diary-entry. 

There is one thing left. You have structured the shell-command according
to the American GoogleCL syntax. That's not working with the German
locale. For a German GoogleCalendar the only syntax I found working is:

  google calendar add --cal org Test am 5.9.2010 um 14:00-16:00

It's not problem, of course, to change the format of the shell-command.
But, the German GoogleCalendar doesn't seem to understand commands with
the time of day as the first argument. For example:

  google calendar add --cal org 14:00-16:00 Test am 5.9.2010

results in an entry called Test am (instead of Test) with the
correct time of the day but on the wrong calendar day, it is inserted to
today's column (Sat 4.9.2010 instead of Sun 5.9.2010). Strangely enough, the
correct date occurs nowhere in the entry, so it was not interpreted as
part of the text. This shows that we are dealing with a bug in GoogleCL.

Alas, there seems no description of the possible syntactical variants
available on the web. So I did try-and-error: with and without the am
and um, with the English on, with ISO formated dates etc etc. Except
the above structure 'text am date um time' no combination works.

I fear, there are only two solutions:

  1. As a workaround I have set my GoogleCalendar to the American
 locale. With that everything works fine.

  2. We have to isolate the time of day from the diary-entry as a
 further variable (not as part of the variable text), so that
 Germans can format the command correctly. Can you help me with
 that?

 However, the mechanism is there to support hooking into capture
 specifically and possibly into org-time-stamp or org-schedule, say. 

I have tried to work out an advice to org-time-stamp and/or
org-remember-finish today. But my Lisp is too weak. I couldn't figure
out how to grab the data.

 I don't use Google calendar for scheduled tasks or deadlines so the
 latter don't matter to me; I use it for appointments and my work flow
 is that I always bring up the agenda view to see if my time is free
 before making the appointment.

That's also my work flow, except of using org-remember k-r instead of
i. I like to have everything in one org-file. But I can get used to
keep my appointments in a separate diary file. I can refile them to the
appropriate places during the weekly review which, then, ends with the
upload of a new ics file.

Thanks for sharing your code and your help

Sven

___
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