Re: [O] Status google calendar sync

2011-06-30 Thread Bastien
Niels Giesen  writes:

> --- a/lisp/org-icalendar.el
> +++ b/lisp/org-icalendar.el
> @@ -412,7 +412,10 @@ When COMBINE is non nil, add the category to each line."
> (if scheduledp (setq summary (concat "S: " summary)))
> (if (string-match "\\`<%%" ts)
> (with-current-buffer sexp-buffer
> - (insert (substring ts 1 -1) " " summary "\n"))
> + (let ((entry (substring ts 1 -1)))
> +   (put-text-property 0 1 'uid
> +  (concat " " prefix uid) entry)
> +   (insert entry " " summary "\n")))
>   (princ (format "BEGIN:VEVENT
>  UID: %s
>  %s

(Note that this has been applied.)

-- 
 Bastien



Re: [O] Status google calendar sync

2011-06-16 Thread Stephen Eglen
Eric S Fraga  wrote:

> Stephen Eglen  writes:
> 
> > Thank you very much Arun, this page looks great:
> >
> >> http://orgmode.org/worg/org-tutorials/org-google-sync.html>
> >
> > 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.
> >
> > Stephen
> 
> The UID entries are necessary if you intend to upload a file that
> contains entries that you previously uploaded.  Without these, any
> pre-existing entry will be duplicated in google's calendar.

Thanks Eric.

Reading around a bit, there seems to be a bit of disquiet about how
google calendar reads .ics files, e.g.:

http://www.google.com/support/forum/p/Calendar/thread?tid=3fad85f47a70864b&hl=en

In particular, it seems odd that there is so much uncertainty about the
interval with which google calendar re-reads the .ics file and updates
the calendar.  I don't mind hitting a *refresh* button within a calendar
to manually force a resync, but there doesn't seem to be such a button!

I think what I'm looking for is a *read-only* solution so that google
calendar just renders the current orgmode.ics file read from the web,
rather than recalling what events were previously read in.(I don't
need to write to this calendar, as my org files are the master.)  In
this way, I would hope the ID entries would not be required.

I'm still in the first days of using my new android phone, so I may be
missing something, but there seemed no other decent calendar tool on the
android market that would just read and render an .ics file from the
web.I did however find this:

https://market.android.com/details?id=org.nightlabs.android.icssync

which sounds useful. Has anyone else seen/tried this?

Stephen



Re: [O] Status google calendar sync

2011-06-15 Thread Eric S Fraga
Nick Dokos  writes:
> Philipp Haselwarter  wrote:

Nick & Philipp,

>> Unfortunately, both the awk script and the org-export-icalendar seem to
>> have quite a hard time with repeating entries.

Yes.  I have extended my awk script to cater for ical events that span
days which does appear to work (to some degree).  See updated version
attached.  This does not handle generic repeated events unfortunately,
but mostly because I'm not sure what the ical format for these might be
(and have been too lazy to look into it).  If you have a good example
(or set of examples) of ical calendar entries that describe repeated
events, I'm happy to work on the awk script further.



ical2org.awk
Description: ical 2 org awk script

[...]

> I agree - I have been thinking (unfortunately mostly only thinking)
> about it and it seems to me that many of the pieces are there, but there
> is a non-trivial amount of work to do this and do it right:
>
> o icalendar.el should be the basis of this, but unfortunately, it is too
>   closely tied to the diary (and is incomplete or buggy in various
> ways).

it would indeed be nice to have an Emacs solution to the google -> org
step.

[...]

> o These converters are ripe for what Kernighan and Plauger call a
>   "left-corner" development approach: just bite the smallest useful
>   subset and add features as needed, deliberately and carefully. Both
>   the current implementation of org-icalendar and Eric F.'s awk script
>   would be useful in this respect: they basically cover the basic
>   functionality needed (but perhaps not completely, as Philipp points
>   out).

In some sense, this is indeed my modus operandum but it's not
necessarily the best approach after a while...

> BTW, the reason I've become interested in this is that recently I
> started being bombarded with meeting invitations generated from (what
> else?) M$ Outlook. My former method of adding the invitations to my
> Org

yes, I am seeing the same thing; I would love to have an automated or
semi-automated procedure to take these things in gnus and create a
capture event.  I look forward to seeing what you have been up to in
this respect!

[...]

> turns-you-to-stone-if-you-look-at-it-ugly) and there are bugs (the most
> serious of which is the icalendar timezone stuff that I referred to in a
> recent thread). I'm trying to fixg the bugs and am working on the
> back-end usability stuff in order to survive the onslaught - but the
> icalendar stuff in the middle is likely to remain unspeakably ugly in
> the foreseeable future - I just have no time for it.

time zones are a nightmare, especially with respect to Google.

> So if anybody is interested, I hope this is useful as a starting
> point.

Very interested and happy to contribute as much as I can!

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.391.gfaccb.dirty)


Re: [O] Status google calendar sync

2011-06-15 Thread Eric S Fraga
Stephen Eglen  writes:

> Thank you very much Arun, this page looks great:
>
>> http://orgmode.org/worg/org-tutorials/org-google-sync.html>
>
> 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.
>
> Stephen

The UID entries are necessary if you intend to upload a file that
contains entries that you previously uploaded.  Without these, any
pre-existing entry will be duplicated in google's calendar.
-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.391.gfaccb.dirty)



Re: [O] Status google calendar sync

2011-06-11 Thread Nick Dokos
Philipp Haselwarter  wrote:

> Unfortunately, both the awk script and the org-export-icalendar seem to
> have quite a hard time with repeating entries.
> ical2org does not honor RRULE at all, the export has some very basic and
> very fragile support, but anything like
> <%%(org-diary-class 16 02 2011 18 05 2011 3)>
> or
> SCHEDULED: <2011-02-20 Sun +1w -2d>
> already fails it.
> 
> I think this is an important topic, especially wrt mobile devices.
> Better interoperability with other calendering systems would greatly
> benefit the org user experience.
> 

I agree - I have been thinking (unfortunately mostly only thinking)
about it and it seems to me that many of the pieces are there, but there
is a non-trivial amount of work to do this and do it right:

o icalendar.el should be the basis of this, but unfortunately, it is too
  closely tied to the diary (and is incomplete or buggy in various ways).

o It should be refactored to convert between an iCalendar file and a
  generic in-memory representation of a calendar: basically an
  attributed tree where the root is the VCALENDAR element, with VEVENTs,
  VTODOs, VALARMs etc. i.e. all the other elements underneath, each
  decorated with the various parameters that apply to it. The
  representation should make it easy to do the next step.

o Converters between the generic in-memory representation and various
  other formats (diary, org) are then needed.

o The refactoring of the original icalendar.el will essentially do this
  for a diary representation.  An org converter along these lines can
  then be fairly easily written I think.

o These converters are ripe for what Kernighan and Plauger call a
  "left-corner" development approach: just bite the smallest useful
  subset and add features as needed, deliberately and carefully. Both
  the current implementation of org-icalendar and Eric F.'s awk script
  would be useful in this respect: they basically cover the basic
  functionality needed (but perhaps not completely, as Philipp points
  out).

I've been working on this along these lines, but time constraints have
made progress almost imperceptibly slow.

BTW, the reason I've become interested in this is that recently I
started being bombarded with meeting invitations generated from (what
else?) M$ Outlook. My former method of adding the invitations to my Org
appointment book by hand is just not sufficient any longer. So I have
mercilessly hacked icalendar.el to invoke an org-capture with the
details, so I can just look it over and file it quickly. At the other
end, I modify the mh-e show hook to scan the message for text/calendar
attachments and kick off the icalendar stuff. But it's not working very
well yet, the hacked icalendar implementation is ugly (think Medusa-
turns-you-to-stone-if-you-look-at-it-ugly) and there are bugs (the most
serious of which is the icalendar timezone stuff that I referred to in a
recent thread). I'm trying to fixg the bugs and am working on the
back-end usability stuff in order to survive the onslaught - but the
icalendar stuff in the middle is likely to remain unspeakably ugly in
the foreseeable future - I just have no time for it.

So if anybody is interested, I hope this is useful as a starting point.

Nick







Re: [O] Status google calendar sync

2011-06-11 Thread Niels Giesen
> 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.

You do not strictly need to, but this is the only way you do not
create double events when exporting an org file to .ics and importing
it into google calendar. If you do use them, a change in a date in
org-mode will be reflected as such in google calendar.

Note that if you /do/ want to store uids for the reason I just wrote,
/and/ if you use diary sexps, you'll need an up-to-date Emacs (from
bazaar) and below patch to org-icalendar.el (this has not been applied
yet to org-mode, alas). Otherwise icalendar.el creates a new uid every
time you export anyway.

--- a/lisp/org-icalendar.el
+++ b/lisp/org-icalendar.el
@@ -412,7 +412,10 @@ When COMBINE is non nil, add the category to each line."
  (if scheduledp (setq summary (concat "S: " summary)))
  (if (string-match "\\`<%%" ts)
  (with-current-buffer sexp-buffer
-   (insert (substring ts 1 -1) " " summary "\n"))
+   (let ((entry (substring ts 1 -1)))
+ (put-text-property 0 1 'uid
+(concat " " prefix uid) entry)
+ (insert entry " " summary "\n")))
(princ (format "BEGIN:VEVENT
 UID: %s
 %s


-- 
http://pft.github.com



Re: [O] Status google calendar sync

2011-06-11 Thread Philipp Haselwarter
Unfortunately, both the awk script and the org-export-icalendar seem to
have quite a hard time with repeating entries.
ical2org does not honor RRULE at all, the export has some very basic and
very fragile support, but anything like
<%%(org-diary-class 16 02 2011 18 05 2011 3)>
or
SCHEDULED: <2011-02-20 Sun +1w -2d>
already fails it.

I think this is an important topic, especially wrt mobile devices.
Better interoperability with other calendering systems would greatly
benefit the org user experience.

-- 
Philipp Haselwarter




Re: [O] Status google calendar sync

2011-06-10 Thread Arun Persaud
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



Re: [O] Status google calendar sync

2011-06-10 Thread Stephen Eglen
Thank you very much Arun, this page looks great:

> http://orgmode.org/worg/org-tutorials/org-google-sync.html>

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.

Stephen




Re: [O] Status google calendar sync

2011-06-10 Thread Arun Persaud
Hi

On 06/10/2011 09:58 AM, Stephen Eglen wrote:
> Was there any update regarding this interesting topic?  I'm keen to get
> something working - what is current best practice for getting
> .ics files made by org put onto google calendar, so that I can view them
> on android?
> 
> Thanks, Stephen

Have a look at:

http://orgmode.org/worg/org-tutorials/org-google-sync.html

The above works well for me, so I haven't changed anything on it
recently, but let us know in case something doesn't work for you and we
can see if we can fix it.

Arun



Re: [O] Status google calendar sync

2011-06-10 Thread Stephen Eglen
Was there any update regarding this interesting topic?  I'm keen to get
something working - what is current best practice for getting
.ics files made by org put onto google calendar, so that I can view them
on android?

Thanks, Stephen



Konrad Hinsen  writes:

> On 14 Feb 2011, at 22:39, Marcelo de Moraes Serpa wrote:
>
>> This would be awesome, and I think this is the path the emacs
>> developers should take -- separating emacs into two, the GUI and the
>> core elisp interpreter. I'm sure this wouldn't be easy, but imagine
>
> Emacs already has a batch mode, and very different GUI layers
> (terminal, X11, Mac, Windows), so I'd suspect that a "no GUI" version
> that can be compiled anywhere would not be so difficult. It may be
> more difficult to make a separate GUI layer, but that wouldn't be very
> important either from a practical point of view.
>
> BTW, another Emacs GUI I'd like to see is a Web-based one. Imagine
> connecting to your home machine from a Web browser and getting access
> to a copy of Emacs running there!
>
> Konrad.
>
> ___
> 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