Re: [O] org-caldav: Sync Org with external calendars through CalDAV (Owncloud, Google, ...)

2012-12-05 Thread Stephen Eglen

 It's bug:

 http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-07/msg00674.html

 Not sure if that fix is in 24.2, but surely the latest pretest for 24.3
 should work (which is pretty stable).

Thanks David; indeed, its working fine now in the 24.2.90 pretest that
was recently released.


 I'm still wondering why it didn't work at the beginning. I mean, even if
 you had your Google username set in some .netrc or .authinfo, the
 password should still work?

The problem (I think) was that I had a misformatted .netrc with a
username in it that I thought was just for one machine, but must have
been for all machines!  Removing that .netrc file solved my problem,
thanks.

Stephen



Re: [O] org-caldav: Sync Org with external calendars through CalDAV (Owncloud, Google, ...)

2012-12-05 Thread Stephen Eglen

Now that I've got org-caldav working (thanks David), here's a simple
helper function so that the files specified in org-agenda-files are
exported.  I hope it works for others too!

(defun org-caldav-set-files-from-org-agenda ()
  Set `org-caldav-files' from the files specified in 'org-agenda-files'.
Ensure however that `org-caldav-inbox' is not included in the file list.
  (let ((files (org-agenda-files)))
(when (member (file-truename org-caldav-inbox) files)
  (setq files (delete (file-truename org-caldav-inbox) files)))
(setq org-caldav-files files)))

(org-caldav-set-files-from-org-agenda)

Stephen



Re: [O] org-caldav: Sync Org with external calendars through CalDAV (Owncloud, Google, ...)

2012-12-04 Thread Suvayu Ali
Hi David,

On Mon, Dec 03, 2012 at 08:50:35PM +0100, David Engster wrote:
 
 I'm at a loss why this happens, and I could not reproduce it with my
 account. This problem really has nothing to do with org-caldav, since it
 is delegating this part to the url package. As I've already written to
 Bastien, please try
 
  (url-retrieve-synchronously

 https://www.google.com/calendar/dav/your-calendar...@group.calendar.google.com/events/;)
 
 If this doesn't ask for your username, then there's your
 problem. Depending on the Emacs version you're using, you might want to
 set
 
 (setq auth-source-debug t)
 
 to see whether some .netrc file or similar is setting the username for
 you (look into the *Messages* buffer).
 

I see the same issue, I get only a password prompt.  This is what I get
on trying your suggestion above.

Contacting host: www.google.com:443
auth-source-search: found 1 results (max 1) matching (:max 1 :host 
www.google.com:443 :port https)
auth-source-search: found 1 CACHED results matching (:max 1 :host 
www.google.com:443 :port https)
#buffer  *http www.google.com:443*-771021

I'm not sure from this if my netrc is being used.  My netrc also has the
password for my Google account, if it is being used should I even get a
password prompt?

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.



Re: [O] org-caldav: Sync Org with external calendars through CalDAV (Owncloud, Google, ...)

2012-12-04 Thread Stephen Eglen

On Tue, Dec 04 2012, Suvayu Ali wrote:

 Hi David,

 On Mon, Dec 03, 2012 at 08:50:35PM +0100, David Engster wrote:
 
 I'm at a loss why this happens, and I could not reproduce it with my
 account. This problem really has nothing to do with org-caldav, since it
 is delegating this part to the url package. As I've already written to
 Bastien, please try
 
  (url-retrieve-synchronously

 https://www.google.com/calendar/dav/your-calendar...@group.calendar.google.com/events/;)
 
 If this doesn't ask for your username, then there's your
 problem. Depending on the Emacs version you're using, you might want to
 set
 
 (setq auth-source-debug t)
 
 to see whether some .netrc file or similar is setting the username for
 you (look into the *Messages* buffer).
 

 I see the same issue, I get only a password prompt.  This is what I get
 on trying your suggestion above.

 Contacting host: www.google.com:443
 auth-source-search: found 1 results (max 1) matching (:max 1 :host 
 www.google.com:443 :port https)
 auth-source-search: found 1 CACHED results matching (:max 1 :host 
 www.google.com:443 :port https)
 #buffer  *http www.google.com:443*-771021

 I'm not sure from this if my netrc is being used.  My netrc also has the
 password for my Google account, if it is being used should I even get a
 password prompt?

 Cheers,

Dear all,
I think it is a problem somewhere with my local setup; if I add the
following to .authinfo (chmod 600) then it uses the right username:

Machine www.google.com login my-gmail-login

I'm now about to see how to setup .authinfo.gpg so that I can also
include my password in that file.

As David has pointed out, try the call to url-retrieve-synchronously
first, as that needs to be working before org-caldav works.

Stephen



Re: [O] org-caldav: Sync Org with external calendars through CalDAV (Owncloud, Google, ...)

2012-12-04 Thread Stephen Eglen
 I think it is a problem somewhere with my local setup; if I add the
 following to .authinfo (chmod 600) then it uses the right username:

 Machine www.google.com login my-gmail-login

 I'm now about to see how to setup .authinfo.gpg so that I can also
 include my password in that file.

Hmmm. not having any luck here; it works with .authinfo, but not with
.authinfo.gpg in Emacs 24.1.

I have

(require 'auth-source)

but it doesn't seem to help.  Does url.el and friends in Emacs 24.1
use auth-source?

Stephen



Re: [O] org-caldav: Sync Org with external calendars through CalDAV (Owncloud, Google, ...)

2012-12-04 Thread David Engster
Stephen Eglen writes:
 I think it is a problem somewhere with my local setup; if I add the
 following to .authinfo (chmod 600) then it uses the right username:

 Machine www.google.com login my-gmail-login

 I'm now about to see how to setup .authinfo.gpg so that I can also
 include my password in that file.

 Hmmm. not having any luck here; it works with .authinfo, but not with
 .authinfo.gpg in Emacs 24.1.

It's bug:

http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-07/msg00674.html

Not sure if that fix is in 24.2, but surely the latest pretest for 24.3
should work (which is pretty stable).

I'm still wondering why it didn't work at the beginning. I mean, even if
you had your Google username set in some .netrc or .authinfo, the
password should still work?

-David



Re: [O] org-caldav: Sync Org with external calendars through CalDAV (Owncloud, Google, ...)

2012-12-04 Thread David Engster
Suvayu Ali writes:
 On Mon, Dec 03, 2012 at 08:50:35PM +0100, David Engster wrote:
 I'm at a loss why this happens, and I could not reproduce it with my
 account. This problem really has nothing to do with org-caldav, since it
 is delegating this part to the url package. As I've already written to
 Bastien, please try
 
  (url-retrieve-synchronously

 https://www.google.com/calendar/dav/your-calendar...@group.calendar.google.com/events/;)
 
 If this doesn't ask for your username, then there's your
 problem. Depending on the Emacs version you're using, you might want to
 set
 
 (setq auth-source-debug t)
 
 to see whether some .netrc file or similar is setting the username for
 you (look into the *Messages* buffer).
 

 I see the same issue, I get only a password prompt.  This is what I get
 on trying your suggestion above.

 Contacting host: www.google.com:443
 auth-source-search: found 1 results (max 1) matching (:max 1 :host
 www.google.com:443 :port https)
 auth-source-search: found 1 CACHED results matching (:max 1 :host
 www.google.com:443 :port https)
 #buffer  *http www.google.com:443*-771021

 I'm not sure from this if my netrc is being used.

Yes. The mesage found 1 results means it found an entry in your .netrc
or .authinfo which matches.

  My netrc also has the password for my Google account, if it is being
 used should I even get a password prompt?

The auth-source stuff can be a bit tricky. For https connections with
the URL package, you need to use the following

  machine www.google.com:443 port https login USERNAME password PASS

That's no typo: You have to use :443 as well as port https. See also

 (info (auth)Help for users)

-David



Re: [O] org-caldav: Sync Org with external calendars through CalDAV (Owncloud, Google, ...)

2012-12-03 Thread Stephen Eglen
David Engster deng at randomsample.de writes:

 
 Bastien writes:
  David Engster deng at randomsample.de writes:
  That is very strange. It should first
  ask: Username [for Google CalDAV]:. If it does not do that, maybe you
  have that information in your .authinfo?
 
  I have this:
 
  machine smtp.gmail.com login bastienguerry at gmail.com password xx
 
 Since we're connecting to google.com this shouldn't matter, obviously,
 thus I'm at a loss why it doesn't ask. I currently cannot test anything
 reliably because I'm on vacation and there's no 3G around here, so I'm
 afraid this has to wait a bit. Unless someone beats me to it. 
 
 -David
 
 

hi David, Bastien,

did either of you resolve this problem about org-caldav just asking for the
password, and not the username?  I am now trying org-caldav, and am seeing the
same problem.  Happy to debug further if you can tell me which functions to look
into.

Thanks, Stephen




Re: [O] org-caldav: Sync Org with external calendars through CalDAV (Owncloud, Google, ...)

2012-12-03 Thread David Engster
Stephen Eglen writes:
 David Engster deng at randomsample.de writes:
 Bastien writes:
  David Engster deng at randomsample.de writes:
  That is very strange. It should first
  ask: Username [for Google CalDAV]:. If it does not do that, maybe you
  have that information in your .authinfo?
 
  I have this:
 
  machine smtp.gmail.com login bastienguerry at gmail.com password xx
 
 Since we're connecting to google.com this shouldn't matter, obviously,
 thus I'm at a loss why it doesn't ask. I currently cannot test anything
 reliably because I'm on vacation and there's no 3G around here, so I'm
 afraid this has to wait a bit. Unless someone beats me to it. 

 did either of you resolve this problem about org-caldav just asking for the
 password, and not the username?  I am now trying org-caldav, and am seeing the
 same problem.  Happy to debug further if you can tell me which functions to 
 look
 into.

I'm at a loss why this happens, and I could not reproduce it with my
account. This problem really has nothing to do with org-caldav, since it
is delegating this part to the url package. As I've already written to
Bastien, please try

 (url-retrieve-synchronously
   
https://www.google.com/calendar/dav/your-calendar...@group.calendar.google.com/events/;)

If this doesn't ask for your username, then there's your
problem. Depending on the Emacs version you're using, you might want to
set

(setq auth-source-debug t)

to see whether some .netrc file or similar is setting the username for
you (look into the *Messages* buffer).

-David




Re: [O] org-caldav: Sync Org with external calendars through CalDAV (Owncloud, Google, ...)

2012-09-11 Thread Philipp Haselwarter
Works with my davical server, as it seems!

But when I refile an entry from org-caldav-inbox to org-caldav-files it
gets downloaded into the inbox again the next time I sync. That's not
supposed to happen, is it?

It'd be neat if editing of synced events worked to a higher extent. Do
you plan on working toward this?

Busy times are announcing themselves and this is what I need to get
through them ;)
-- 
Philipp Haselwarter




Re: [O] org-caldav: Sync Org with external calendars through CalDAV (Owncloud, Google, ...)

2012-08-05 Thread David Engster
Bastien writes:
 David Engster d...@randomsample.de writes:
 That is very strange. It should first
 ask: Username [for Google CalDAV]:. If it does not do that, maybe you
 have that information in your .authinfo?

 I have this:

 machine smtp.gmail.com login bastiengue...@gmail.com password xx

Since we're connecting to google.com this shouldn't matter, obviously,
thus I'm at a loss why it doesn't ask. I currently cannot test anything
reliably because I'm on vacation and there's no 3G around here, so I'm
afraid this has to wait a bit. Unless someone beats me to it. ;-)

-David



Re: [O] org-caldav: Sync Org with external calendars through CalDAV (Owncloud, Google, ...)

2012-08-04 Thread Bastien
David Engster d...@randomsample.de writes:

 Then I guess you patched org-caldav-sync to not test for
 `url-dav-patched-version'? Anyway, I've now added support for the
 Emacs-bzr version of url-dav.

Yes I did.

 It does not ask for a username? 

NO.

 That is very strange. It should first
 ask: Username [for Google CalDAV]:. If it does not do that, maybe you
 have that information in your .authinfo?

I have this:

machine smtp.gmail.com login bastiengue...@gmail.com password xx

 Please restart Emacs and evaluate

 (url-retrieve-synchronously
   
 https://www.google.com/calendar/dav/4ttssrunbsh9km06csbjkb2...@group.calendar.google.com/events/;)

 Does that one ask you for a username?

No, just for a password.  I enter my password and I'm asked for a
password, indefinitely.

This is with GNU Emacs 24.1.50.1 (i686-pc-linux-gnu, GTK+ Version
2.24.10) of 2012-07-26 on myhost.

-- 
 Bastien



Re: [O] org-caldav: Sync Org with external calendars through CalDAV (Owncloud, Google, ...)

2012-08-03 Thread Bastien
Hi David,

David Engster d...@randomsample.de writes:

 https://github.com/dengste/org-caldav

Thanks for this.  I tested it but can't make it work.

I use Emacs from after your patch to url-dav (7/26/2012)
and I use this simple configuration:

(setq org-caldav-calendar-id 
4ttssrunbsh9km06csbjkb2...@group.calendar.google.com
  org-caldav-url https://www.google.com/calendar/dav;
  org-caldav-files '(~/org/rdv.org)
  org-caldav-inbox ~/org/inbox.org)

(The id is a true one for a public test calendar.)

Then I'm asked for a password.

I tried entering my Google password directly, then my username and my
password, then I gave up.

I guess I miss something obvious.  Thanks for your help!

-- 
 Bastien



Re: [O] org-caldav: Sync Org with external calendars through CalDAV (Owncloud, Google, ...)

2012-08-03 Thread David Engster
Bastien writes:
 I use Emacs from after your patch to url-dav (7/26/2012)

Then I guess you patched org-caldav-sync to not test for
`url-dav-patched-version'? Anyway, I've now added support for the
Emacs-bzr version of url-dav.

 and I use this simple configuration:

 (setq org-caldav-calendar-id
 4ttssrunbsh9km06csbjkb2...@group.calendar.google.com
   org-caldav-url https://www.google.com/calendar/dav;
   org-caldav-files '(~/org/rdv.org)
   org-caldav-inbox ~/org/inbox.org)

 (The id is a true one for a public test calendar.)

 Then I'm asked for a password.

It does not ask for a username? That is very strange. It should first
ask: Username [for Google CalDAV]:. If it does not do that, maybe you
have that information in your .authinfo?

Please restart Emacs and evaluate

(url-retrieve-synchronously
  
https://www.google.com/calendar/dav/4ttssrunbsh9km06csbjkb2...@group.calendar.google.com/events/;)

Does that one ask you for a username?

-David



Re: [O] org-caldav: Sync Org with external calendars through CalDAV (Owncloud, Google, ...)

2012-07-26 Thread Aurélien Aptel
On Fri, Jul 20, 2012 at 6:36 PM, David Engster d...@randomsample.de wrote:
 I must admit I'm a tiny bit baffled that no one seems to be interested
 in this. Anyway, no hard feelings ( ;-) ), but could please someone with

I'm interested in this too for my own project Org-sync [1], even if
calendars are not *directly* related to it.

1: 
http://orgmode.org/worg/org-contrib/gsoc2012/student-projects/org-sync/index.html



[O] org-caldav: Sync Org with external calendars through CalDAV (Owncloud, Google, ...)

2012-07-14 Thread David Engster
I have written a package 'org-caldav' which can sync items to a remote
calendar server using the CalDAV protocol. The main purpose of this
package is to make better use of Org in combination with Android-based
mobile devices (yes, there is mobileOrg, but I have several problems
with it; that's a topic for another day, though).

I think org-caldav is now good enough to allow some testing by
adventurous people. I put the code up on github here

https://github.com/dengste/org-caldav

I've tested the code with my Owncloud server and also with Google
Calendar. Please see the Readme on how to set things up. Most
importantly, please use a new, dedicated calendar for testing this
package; do *not* use your precious main calendar. Also, while
org-caldav should only access the calendar you provide through
`org-caldav-calendar-id', you should have a backup of all your calendar
data, just in case.

The initial sync can take some time, depending on the number of
events. Especially the CalDAV interface to Google can be quite slow at
times. If the initial sync aborts for any reason, just run
`org-caldav-sync' again. Note that after the initial sync, only new
events will be transferred, so things should become much snappier.

A few further notes regarding the code:

I am relying mainly on three other packages to do the real heavy
lifting, which is also why org-caldav is actually pretty small:

- url-dav.el for talking to WebDAV servers (CalDAV is essentially WebDAV
  with a few extensions). Unfortunately, the current version of url-dav
  that is shipping with Emacs is broken for practically all CalDAV
  servers (see bug #11916), which is why I provide a patched version of
  url-dav.el in the above repository. You have to make sure that this
  patched version is loaded instead of the one in Emacs proper. I am
  hoping that this will be fixed in Emacs 24.2.

- org-icalendar.el is doing all the conversion from org to icalendar
  events which are needed for CalDAV. This has the advantage that you
  can use all the variables from that package to control how things
  should be exported. The only exception is the actual org files being
  searched for time stamps, which is determined through
  `org-caldav-files'.

- icalendar.el for parsing events from CalDAV. I took some code from
  that package to generate org items from the calendar events.

The syncing between org and the external calendar is not yet really
finished. I would like to have proper two-way-syncing so that you can
freely change events on any side, but this is rather difficult to do and
I'd first like to get some feedback on the current code. Also, I have
a hunch that some Org experts around here might have some good ideas on
how to properly implement this.

Here's what the code can currently do:

- All items in `org-caldav-files' with active time stamps are synced to
  the calendar.

- If you change an item in one of those files in orgmode, this change
  will also get synced to the external calendar (to be exact: this will
  generate a new event and the old one will be deleted).

- If you create a *new* event in the calendar through Android or any
  other client (like browser), this event will land in the
  `org-caldav-inbox' file as an org item.

However:

- If you *change* an item directly on the CalDAV server, this will *not*
  get synced back to Org. What happens exactly depends on the server
  (whether it renames the event or not). Just try it out. The item might
  even get deleted after the next sync - you have been warned.

- Likewise, if you *change* and item in `org-caldav-inbox', this will
  not get synced back to the calendar.

OK, this has gotten way too long already. Please try it out and let me
know how it goes.

Cheers,
David