Re: [O] [bug] org-agenda-write does not handle date stamps without day of week

2012-04-10 Thread Bastien
Hi Carsten and all,

Carsten Dominik carsten.domi...@gmail.com writes:

 since we did make a change to Org a while ago to allow date stamps
 without the name of the day, I think it is only consequent to also do
 it for this case.  Must have slipped our attention back then.
 The only thing we must ensure is that this regexp matches fast
 as it is used a lot.

 Nick's proposal works, except for the fact that is also matches when
 the time is directly attached to day name.  Maybe it is cleaner to
 not match in this case.

 If we are going to make the day name optional, then it is better to
 include matching of the whitespace after the date into the day-name
 part of the regexp.

Agreed.

 I am attaching Nick's file again, with a third proposal for an
 updated regexp.

I tested it from reproducer.org (had to add a missing parenthesis) 
and it seems to work fine.

Carsten, please feel free to apply a patch with your new org-ts-regexp0
proposal against master HEAD.

Thanks!

-- 
 Bastien



Re: [O] [bug] org-agenda-write does not handle date stamps without day of week

2012-04-10 Thread Nick Dokos
Bastien b...@gnu.org wrote:

 Hi Carsten and all,
 
 Carsten Dominik carsten.domi...@gmail.com writes:
 
  since we did make a change to Org a while ago to allow date stamps
  without the name of the day, I think it is only consequent to also do
  it for this case.  Must have slipped our attention back then.
  The only thing we must ensure is that this regexp matches fast
  as it is used a lot.
 
  Nick's proposal works, except for the fact that is also matches when
  the time is directly attached to day name.  Maybe it is cleaner to
  not match in this case.
 
  If we are going to make the day name optional, then it is better to
  include matching of the whitespace after the date into the day-name
  part of the regexp.
 
 Agreed.
 
  I am attaching Nick's file again, with a third proposal for an
  updated regexp.
 
 I tested it from reproducer.org (had to add a missing parenthesis) 
 and it seems to work fine.
 
 Carsten, please feel free to apply a patch with your new org-ts-regexp0
 proposal against master HEAD.
 

I think he did already (but please check!):

commit 7d84b300f4cba8b726662113d4ce4ff40a76c5b5

Thanks,
Nick




Re: [O] [bug] org-agenda-write does not handle date stamps without day of week

2012-04-10 Thread Bastien
Nick Dokos nicholas.do...@hp.com writes:

 I think he did already (but please check!):

 commit 7d84b300f4cba8b726662113d4ce4ff40a76c5b5

You're right -- time to power off my computer :)

Thanks!

-- 
 Bastien



Re: [O] [bug] org-agenda-write does not handle date stamps without day of week

2012-03-21 Thread Karl Voit
Hi!

* Nick Dokos nicholas.do...@hp.com wrote:

 Check that you picked up Carsten's fix (commit ):
   git show 7d84b300f4cba8b726662113d4ce4ff40a76c5b5

I do. I did a «git pull» and the «git show» from above shows me
Casten's fix.

 If you did M-x org-reload RET only, then that's probably the reason:
 check to see if the value of org-ts-regexp0 has been updated; in my case
 it hadn't and I ended up doing M-x load-file RET /path/to/org.el RET.
 Alternatively, restart emacs.

Being very unsure what needs to be restarted at such updates, I
quit Emacs before the git commands and start it again afterwards.

So I quit Emacs again, did another «git pull» a couple of minutes
ago, compiled all *.el once again, started Emacs, generated the ICS
file and now the times get written to ICS:

,[ Org-mode entries ]
| ** 2012-03-21 08:12 TSTest
| :PROPERTIES:
| :CREATED: [2012-03-20 Tue 10:38]
| :END:
|
| ** 2012-03-21 08:07-13:12 TSTest
| :PROPERTIES:
| :CREATED: [2012-03-20 Tue 10:40]
| :END:
`

,[ ICS entries ]
| BEGIN:VEVENT
| UID: TS-4ae514e8-210c-408b-bb08-254dcb3a5277
| DTSTART:20120321T081200
| DTEND:20120321T101200
| SUMMARY: TSTest
| CATEGORIES:misc
| END:VEVENT
| BEGIN:VEVENT
| UID: TS-cab4b928-1960-4335-b2e8-2179e66eec5a
| DTSTART:20120321T080700
| DTEND:20120321T131200
| SUMMARY: TSTest
| CATEGORIES:misc
| END:VEVENT
`

ICS look great! Thank you guys for tracing the problem and fixing
it! I really appreciate the help!


So far, Google calendar does not use the time information of those
two test entries :-(

But since the ICS data seems to be OK there might be another hiccup
by Google this time. I created new test entries with different names
and wait for Google calendar to re-read the new data.

I am optimistic that this is just a caching problem of Google
because I did not change the descriptions during my last test.

-- 
Karl Voit




Re: [O] [bug] org-agenda-write does not handle date stamps without day of week

2012-03-21 Thread Carsten Dominik

On 21.3.2012, at 17:32, Karl Voit wrote:

 Hi!
 
 * Nick Dokos nicholas.do...@hp.com wrote:
 
 Check that you picked up Carsten's fix (commit ):
  git show 7d84b300f4cba8b726662113d4ce4ff40a76c5b5
 
 I do. I did a «git pull» and the «git show» from above shows me
 Casten's fix.
 
 If you did M-x org-reload RET only, then that's probably the reason:
 check to see if the value of org-ts-regexp0 has been updated; in my case
 it hadn't and I ended up doing M-x load-file RET /path/to/org.el RET.
 Alternatively, restart emacs.
 
 Being very unsure what needs to be restarted at such updates,

The reason why just reloading a file does not work here is that the
regexp is defined as a constant (defconst), which will not be changed on
executing the defconst again.  So exiting and restarting Emacs is the
right thing to do.

- Carsten

 I
 quit Emacs before the git commands and start it again afterwards.
 
 So I quit Emacs again, did another «git pull» a couple of minutes
 ago, compiled all *.el once again, started Emacs, generated the ICS
 file and now the times get written to ICS:
 
 ,[ Org-mode entries ]
 | ** 2012-03-21 08:12 TSTest
 | :PROPERTIES:
 | :CREATED: [2012-03-20 Tue 10:38]
 | :END:
 |
 | ** 2012-03-21 08:07-13:12 TSTest
 | :PROPERTIES:
 | :CREATED: [2012-03-20 Tue 10:40]
 | :END:
 `
 
 ,[ ICS entries ]
 | BEGIN:VEVENT
 | UID: TS-4ae514e8-210c-408b-bb08-254dcb3a5277
 | DTSTART:20120321T081200
 | DTEND:20120321T101200
 | SUMMARY: TSTest
 | CATEGORIES:misc
 | END:VEVENT
 | BEGIN:VEVENT
 | UID: TS-cab4b928-1960-4335-b2e8-2179e66eec5a
 | DTSTART:20120321T080700
 | DTEND:20120321T131200
 | SUMMARY: TSTest
 | CATEGORIES:misc
 | END:VEVENT
 `
 
 ICS look great! Thank you guys for tracing the problem and fixing
 it! I really appreciate the help!
 
 
 So far, Google calendar does not use the time information of those
 two test entries :-(
 
 But since the ICS data seems to be OK there might be another hiccup
 by Google this time. I created new test entries with different names
 and wait for Google calendar to re-read the new data.
 
 I am optimistic that this is just a caching problem of Google
 because I did not change the descriptions during my last test.
 
 -- 
 Karl Voit
 
 




Re: [O] [bug] org-agenda-write does not handle date stamps without day of week

2012-03-20 Thread Karl Voit
* Carsten Dominik carsten.domi...@gmail.com wrote:
 I have just pushed the new version of this regexp into master.

Very cool!

 Karl, let me know if it fixes the issues you where having
 with writing agendas.

My agenda looks fine. But generating the ics file still results in
events without the time information:

,[ my function generating the ics ]
| (defun vk-export-agenda()
|   Exports monthly Org-mode agenda to agenda.ics file
|   (interactive)
|   (org-agenda-list nil nil 60)
|   (org-agenda-write ~/share/all/org-mode/agenda.ics)
| )
`

with:

,[ example events ]
| ** 2012-03-20 8:00-9:30 Test
| :PROPERTIES:
| :CREATED: [2012-03-20 Tue 10:38]
| :END:
|
| ** 2012-03-20 8:12-13:12 Test
| :PROPERTIES:
| :CREATED: [2012-03-20 Tue 10:40]
| :END:
`

results in:

,[ ics result ]
| vk@gary ~all/org-mode (git)-[master] % grep -C 2 Test agenda.ics
| DTSTART;VALUE=DATE:20120320
| DTEND;VALUE=DATE:20120320
| SUMMARY: Test
| CATEGORIES:misc
| END:VEVENT
| --
| DTSTART;VALUE=DATE:20120320
| DTEND;VALUE=DATE:20120320
| SUMMARY: Test
| CATEGORIES:misc
| END:VEVENT
| vk@gary ~all/org-mode (git)-[master] %
`

-- 
Karl Voit




Re: [O] [bug] org-agenda-write does not handle date stamps without day of week

2012-03-20 Thread Nick Dokos
Karl Voit devn...@karl-voit.at wrote:

 * Carsten Dominik carsten.domi...@gmail.com wrote:
  I have just pushed the new version of this regexp into master.
 
 Very cool!
 
  Karl, let me know if it fixes the issues you where having
  with writing agendas.
 
 My agenda looks fine. But generating the ics file still results in
 events without the time information:
 
 ,[ my function generating the ics ]
 | (defun vk-export-agenda()
 |   Exports monthly Org-mode agenda to agenda.ics file
 |   (interactive)
 |   (org-agenda-list nil nil 60)
 |   (org-agenda-write ~/share/all/org-mode/agenda.ics)
 | )
 `
 
 with:
 
 ,[ example events ]
 | ** 2012-03-20 8:00-9:30 Test
 | :PROPERTIES:
 | :CREATED: [2012-03-20 Tue 10:38]
 | :END:
 |
 | ** 2012-03-20 8:12-13:12 Test
 | :PROPERTIES:
 | :CREATED: [2012-03-20 Tue 10:40]
 | :END:
 `
 
 results in:
 
 ,[ ics result ]
 | vk@gary ~all/org-mode (git)-[master] % grep -C 2 Test agenda.ics
 | DTSTART;VALUE=DATE:20120320
 | DTEND;VALUE=DATE:20120320
 | SUMMARY: Test
 | CATEGORIES:misc
 | END:VEVENT
 | --
 | DTSTART;VALUE=DATE:20120320
 | DTEND;VALUE=DATE:20120320
 | SUMMARY: Test
 | CATEGORIES:misc
 | END:VEVENT
 | vk@gary ~all/org-mode (git)-[master] %
 `
 

I get

BEGIN:VEVENT
UID: TS-11c60341-06a6-4b6f-bb22-2ccd739bbdc8
DTSTART:20120320T08
DTEND:20120320T093000
SUMMARY: Test
CATEGORIES:foo
END:VEVENT

BEGIN:VEVENT
UID: TS-dc99f34e-e24a-4ecc-add5-fa67649b005e
DTSTART:20120320T081200
DTEND:20120320T131200
SUMMARY: Test
CATEGORIES:foo
END:VEVENT

which looks correct to me.

Check that you picked up Carsten's fix (commit ):

  git show 7d84b300f4cba8b726662113d4ce4ff40a76c5b5

If you did M-x org-reload RET only, then that's probably the reason:
check to see if the value of org-ts-regexp0 has been updated; in my case
it hadn't and I ended up doing M-x load-file RET /path/to/org.el RET.
Alternatively, restart emacs.

Nick




Re: [O] [bug] org-agenda-write does not handle date stamps without day of week

2012-03-20 Thread Carsten Dominik
Hi Karl,

I am not able to reproduce this.  I am getting

BEGIN:VEVENT
UID: TS-13B9F6A7-BF2B-445C-84CA-7FB8ED15E0C1
DTSTART:20120320T08
DTEND:20120320T093000
SUMMARY: Test
CATEGORIES:x
END:VEVENT
BEGIN:VEVENT
UID: TS-AF0458B6-C5D6-4419-9DBB-FAB0651EF870
DTSTART:20120320T081200
DTEND:20120320T131200
SUMMARY: Test
CATEGORIES:x
END:VEVENT

Looks right to me.

- Carsten

On 20.3.2012, at 13:26, Karl Voit wrote:

 * Carsten Dominik carsten.domi...@gmail.com wrote:
 I have just pushed the new version of this regexp into master.
 
 Very cool!
 
 Karl, let me know if it fixes the issues you where having
 with writing agendas.
 
 My agenda looks fine. But generating the ics file still results in
 events without the time information:
 
 ,[ my function generating the ics ]
 | (defun vk-export-agenda()
 |   Exports monthly Org-mode agenda to agenda.ics file
 |   (interactive)
 |   (org-agenda-list nil nil 60)
 |   (org-agenda-write ~/share/all/org-mode/agenda.ics)
 | )
 `
 
 with:
 
 ,[ example events ]
 | ** 2012-03-20 8:00-9:30 Test
 | :PROPERTIES:
 | :CREATED: [2012-03-20 Tue 10:38]
 | :END:
 |
 | ** 2012-03-20 8:12-13:12 Test
 | :PROPERTIES:
 | :CREATED: [2012-03-20 Tue 10:40]
 | :END:
 `
 
 results in:
 
 ,[ ics result ]
 | vk@gary ~all/org-mode (git)-[master] % grep -C 2 Test agenda.ics
 | DTSTART;VALUE=DATE:20120320
 | DTEND;VALUE=DATE:20120320
 | SUMMARY: Test
 | CATEGORIES:misc
 | END:VEVENT
 | --
 | DTSTART;VALUE=DATE:20120320
 | DTEND;VALUE=DATE:20120320
 | SUMMARY: Test
 | CATEGORIES:misc
 | END:VEVENT
 | vk@gary ~all/org-mode (git)-[master] %
 `
 
 -- 
 Karl Voit
 
 




Re: [O] [bug] org-agenda-write does not handle date stamps without day of week

2012-03-19 Thread Carsten Dominik

On 17.3.2012, at 07:45, Nick Dokos wrote:

 Karl Voit devn...@karl-voit.at wrote:
 
 * Nick Dokos nicholas.do...@hp.com wrote:
 Karl Voit devn...@karl-voit.at wrote:
 
 For me, it was a no time to work on org - stash it...
 
 OK. I just wanted to make sure that it *is* on someone's todo list
 :-)
 
 * Karl Voit devn...@karl-voit.at wrote:
 
 * 2012-03-05 08:00-09:00 Wrong: ends up as full day event
 
 org-agenda-write calls org-export-icalendar which calls 
 org-print-icalendar-entries
 which loops over all the entries and parses them, decomposing them into 
 timestamps.
 Each timestamp is then passed to org-parse-time-string. It's this one that 
 cannot
 handle non-standard formats: it uses a regexp and assumes that all the 
 matched parts
 are going to be in fixed places:
 
 As to how to fix it, there are several possibilities:
 
 1. fix your scripts that produce time stamps to include day-of-week.
 
 Sorry, deriving DOW from an arbitrary timestamps from arbitrary data
 sources is either pretty time consuming (calendar calculations) or
 simply hard to calculate.
 
 Outside Org-mode, DOW is seldom part of time-stamp data :-(
 
 2. change the callers of org-parse-time-string to make sure that DOW is 
 included.
 There are roughly three dozen callers, so 2. is possible but a pain.
 
 Ack.
 
 3. change just one caller: org-print-icalendar-entries to make sure that 
 DOW is included.
 3. is simple but ugly as sin, 
 
 Ouch, ack :-)
 
 4. change org-parse-time-string to handle a missing DOW.
 4. is the best way to handle it within org.
 
 Full ack.
 
 I vote for 1. where *you* have to do all the work ;-)
 
 YMMD :-)
 
 If my brain would be compatible to ELISP, I'd send a patch.
 Promised.
 
 But I'll take my chance and wait for someone else (you?)
 implementing 4. to resolve this issue for everybody. I really
 appreciate every second you guys invest in maintaining Org-mode!
 
 
 I don't know about you, but whenever I engage in hand-to-hand combat
 with a complicated regexp, I come out bruised, muddied and a lot worse
 for wear. In any case, I'm attaching an org file with my investigations.
 It contains a description and a code block for testing.
 
 I hope that the attachment will come through unscathed: it contains
 regexps, and munging a regexp that looks like hen scratchings in the
 first place through uncooperative mailers is not something to be
 relished.
 
 BTW, I'm not advocating a change: I'll leave it to Karl to do that if he
 really wants to and to the maintainers to decide whether it's worth
 doing. But it can be done (more or less). And maybe somebody will come
 up with a better way than the proof-of-concept that I'm attaching here.

Hi Nick and Karl,

since we did make a change to Org a while ago to allow date stamps
without the name of the day, I think it is only consequent to also do
it for this case.  Must have slipped our attention back then.
The only thing we must ensure is that this regexp matches fast
as it is used a lot.

Nick's proposal works, except for the fact that is also matches when
the time is directly attached to day name.  Maybe it is cleaner to
not match in this case.

If we are going to make the day name optional, then it is better to
include matching of the whitespace after the date into the day-name
part of the regexp.

I am attaching Nick's file again, with a third proposal for an
updated regexp.

As far as speed is concerned, this regexp will, if there is name
and time, match directly and straight.  If the date name is
missing, it will notice on the first digit belonging to
the time and switch without backtracking (well, minimal
backtracking when there are multiple spaces) to the regexp
section for the time of day.  Rematching the spaces after the
date will be the only overhead.

Cheers

- Carsten



reproducer.org
Description: Binary data




 
 Nick
 
 PS. BTW, if you look at the attachment, it helps if you have a wide window,
something like 165 characters wide.
 
 reproducer.org



Re: [O] [bug] org-agenda-write does not handle date stamps without day of week

2012-03-19 Thread Carsten Dominik

On 17.3.2012, at 15:04, Simon Thum wrote:

 Hi Karl,
 
 why don't you add something like an xx day which will probably please 
 org-mode - in my tests org ignored the weekday.

Yes, the weekday is only expected, but never used, so writing xxx
would work.  However, see my other mail for another proposal
along Nick's lines of argument.

- Carsten


 I concluded it's there for viewing convenience, and editing (C-.) always got 
 me the right DOW.
 
 I don't use org2ical, however.
 
 Cheers,
 
 Simon
 
 
 On 03/05/2012 03:44 PM, Karl Voit wrote:
 Hi!
 
 I verified the behavior below with the most current git version of
 Org-mode.
 
 Whenever I call my function to export the current agenda, it
 «converts» events that do have a beginning and end time to events
 that span the whole day (without begin and end times at all).
 
 ,[ my LISP command to export ]
 | (defun vk-export-agenda()
 |   Exports monthly Org-mode agenda to agenda.ics file
 |   (interactive)
 |   (org-agenda-list nil nil 60)
 |   (org-agenda-write ~/org/agenda.ics)
 | )
 `
 
 I traced down the problem to this:
 
 *2012-03-05 Mon 08:00-09:00  works fine
 *2012-03-05 Mon 8:00-9:00  works fine too
 
 *2012-03-05 08:00-09:00  Wrong: ends up as full day event
 
 Unfortunately, I do have certain mechanisms that generate parts of
 my Org-mode files where I skip the day of the week. Org-mode in
 general is able to handle date stamps without day of week pretty
 well. But whenever I export it to ics (in order to send it to
 Google), I end up with a messed up online agenda.
 
 I guess that org-agenda-write is the one to blame. It would be very
 handy to me if somebody could fix that issue.
 
 Let me know, if you need any further information!
 
 Thank you very much!
 
 
 




Re: [O] [bug] org-agenda-write does not handle date stamps without day of week

2012-03-19 Thread Carsten Dominik
I have just pushed the new version of this regexp into master.

Karl, let me know if it fixes the issues you where having
with writing agendas.

- Carsten

On 19.3.2012, at 10:12, Carsten Dominik wrote:

 
 On 17.3.2012, at 07:45, Nick Dokos wrote:
 
 Karl Voit devn...@karl-voit.at wrote:
 
 * Nick Dokos nicholas.do...@hp.com wrote:
 Karl Voit devn...@karl-voit.at wrote:
 
 For me, it was a no time to work on org - stash it...
 
 OK. I just wanted to make sure that it *is* on someone's todo list
 :-)
 
 * Karl Voit devn...@karl-voit.at wrote:
 
 * 2012-03-05 08:00-09:00 Wrong: ends up as full day event
 
 org-agenda-write calls org-export-icalendar which calls 
 org-print-icalendar-entries
 which loops over all the entries and parses them, decomposing them into 
 timestamps.
 Each timestamp is then passed to org-parse-time-string. It's this one that 
 cannot
 handle non-standard formats: it uses a regexp and assumes that all the 
 matched parts
 are going to be in fixed places:
 
 As to how to fix it, there are several possibilities:
 
 1. fix your scripts that produce time stamps to include day-of-week.
 
 Sorry, deriving DOW from an arbitrary timestamps from arbitrary data
 sources is either pretty time consuming (calendar calculations) or
 simply hard to calculate.
 
 Outside Org-mode, DOW is seldom part of time-stamp data :-(
 
 2. change the callers of org-parse-time-string to make sure that DOW is 
 included.
 There are roughly three dozen callers, so 2. is possible but a pain.
 
 Ack.
 
 3. change just one caller: org-print-icalendar-entries to make sure that 
 DOW is included.
 3. is simple but ugly as sin, 
 
 Ouch, ack :-)
 
 4. change org-parse-time-string to handle a missing DOW.
 4. is the best way to handle it within org.
 
 Full ack.
 
 I vote for 1. where *you* have to do all the work ;-)
 
 YMMD :-)
 
 If my brain would be compatible to ELISP, I'd send a patch.
 Promised.
 
 But I'll take my chance and wait for someone else (you?)
 implementing 4. to resolve this issue for everybody. I really
 appreciate every second you guys invest in maintaining Org-mode!
 
 
 I don't know about you, but whenever I engage in hand-to-hand combat
 with a complicated regexp, I come out bruised, muddied and a lot worse
 for wear. In any case, I'm attaching an org file with my investigations.
 It contains a description and a code block for testing.
 
 I hope that the attachment will come through unscathed: it contains
 regexps, and munging a regexp that looks like hen scratchings in the
 first place through uncooperative mailers is not something to be
 relished.
 
 BTW, I'm not advocating a change: I'll leave it to Karl to do that if he
 really wants to and to the maintainers to decide whether it's worth
 doing. But it can be done (more or less). And maybe somebody will come
 up with a better way than the proof-of-concept that I'm attaching here.
 
 Hi Nick and Karl,
 
 since we did make a change to Org a while ago to allow date stamps
 without the name of the day, I think it is only consequent to also do
 it for this case.  Must have slipped our attention back then.
 The only thing we must ensure is that this regexp matches fast
 as it is used a lot.
 
 Nick's proposal works, except for the fact that is also matches when
 the time is directly attached to day name.  Maybe it is cleaner to
 not match in this case.
 
 If we are going to make the day name optional, then it is better to
 include matching of the whitespace after the date into the day-name
 part of the regexp.
 
 I am attaching Nick's file again, with a third proposal for an
 updated regexp.
 
 As far as speed is concerned, this regexp will, if there is name
 and time, match directly and straight.  If the date name is
 missing, it will notice on the first digit belonging to
 the time and switch without backtracking (well, minimal
 backtracking when there are multiple spaces) to the regexp
 section for the time of day.  Rematching the spaces after the
 date will be the only overhead.
 
 Cheers
 
 - Carsten
 
 reproducer.org
 
 
 
 
 Nick
 
 PS. BTW, if you look at the attachment, it helps if you have a wide window,
   something like 165 characters wide.
 
 reproducer.org
 




Re: [O] [bug] org-agenda-write does not handle date stamps without day of week

2012-03-17 Thread Nick Dokos
Karl Voit devn...@karl-voit.at wrote:

 * Nick Dokos nicholas.do...@hp.com wrote:
  Karl Voit devn...@karl-voit.at wrote:
 
  For me, it was a no time to work on org - stash it...
 
 OK. I just wanted to make sure that it *is* on someone's todo list
 :-)
 
  * Karl Voit devn...@karl-voit.at wrote:
  
   * 2012-03-05 08:00-09:00 Wrong: ends up as full day event
 
  org-agenda-write calls org-export-icalendar which calls 
  org-print-icalendar-entries
  which loops over all the entries and parses them, decomposing them into 
  timestamps.
  Each timestamp is then passed to org-parse-time-string. It's this one that 
  cannot
  handle non-standard formats: it uses a regexp and assumes that all the 
  matched parts
  are going to be in fixed places:
 
  As to how to fix it, there are several possibilities:
 
  1. fix your scripts that produce time stamps to include day-of-week.
 
 Sorry, deriving DOW from an arbitrary timestamps from arbitrary data
 sources is either pretty time consuming (calendar calculations) or
 simply hard to calculate.
 
 Outside Org-mode, DOW is seldom part of time-stamp data :-(
 
  2. change the callers of org-parse-time-string to make sure that DOW is 
  included.
  There are roughly three dozen callers, so 2. is possible but a pain.
 
 Ack.
 
  3. change just one caller: org-print-icalendar-entries to make sure that 
  DOW is included.
  3. is simple but ugly as sin, 
 
 Ouch, ack :-)
 
  4. change org-parse-time-string to handle a missing DOW.
  4. is the best way to handle it within org.
 
 Full ack.
 
  I vote for 1. where *you* have to do all the work ;-)
 
 YMMD :-)
 
 If my brain would be compatible to ELISP, I'd send a patch.
 Promised.
 
 But I'll take my chance and wait for someone else (you?)
 implementing 4. to resolve this issue for everybody. I really
 appreciate every second you guys invest in maintaining Org-mode!
 

I don't know about you, but whenever I engage in hand-to-hand combat
with a complicated regexp, I come out bruised, muddied and a lot worse
for wear. In any case, I'm attaching an org file with my investigations.
It contains a description and a code block for testing.

I hope that the attachment will come through unscathed: it contains
regexps, and munging a regexp that looks like hen scratchings in the
first place through uncooperative mailers is not something to be
relished.

BTW, I'm not advocating a change: I'll leave it to Karl to do that if he
really wants to and to the maintainers to decide whether it's worth
doing. But it can be done (more or less). And maybe somebody will come
up with a better way than the proof-of-concept that I'm attaching here.

Nick

PS. BTW, if you look at the attachment, it helps if you have a wide window,
something like 165 characters wide.

* Modify org-ts-regexpr0 to satisfy Karl Voit :-)

This is an attempt to allow timestamps without a day-of-week.

Modifying complicated regexps is no fun: I had to resort to re-builder
to figure out what was going on. The problem was that the first  * which
is supposed to eat all the spaces between the 2012-03-05 part and
the Mon part, would, in the absence of the Mon part, eat the space
before the time spec 08:00. But the regexp for the time part explicitly
requires that space (see the second sp in the explanatory line below).
So I tried making the DOW part optional by appending a ?, but that didn't
do the trick. re-builder showed the space problem: there was no space left
to match if DOW is absent, so I changed the literal space   to 0 or more
spaces  * and that did the trick (with some caveats noted below).

In the code block below, tslist is a list of test cases. The code
block sets org-ts-regexp0 first to its original value, then to the
changed value (the first one is there just for comparison between the
two). I've marked the changes (of which, the second is the significant
one). We map the function org-parse-time-string over the test
cases and get a list of results. The results look reasonable, but the
new regexp allows funny-looking input like the second and fourth test
case.

One additional caveat is that org-odt uses org-ts-regexp0, so changing
it without checking org-odt's use is fraught with peril, but that's what
I've done: I have no idea whether it causes problems in org-odt.

#+BEGIN_SRC elisp
  ;   year___-   month__-   day 
   sp   DOW   sp  hour_:   minutes
  (setq org-ts-regexp0 
\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\) *\\([^]+0-9\r\n 
-]*\\)\\( \\([0-9]\\{1,2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\))
  ; changed 
   vv
  (setq org-ts-regexp0 
\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\) *\\([^]+0-9\r\n 
-]*\\)?\\( *\\([0-9]\\{1,2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\))
  (setq tslist '(
  2012-03-05 Mon 08:00
  2012-03-05 Mon08:00
  2012-03-05 Mon 

Re: [O] [bug] org-agenda-write does not handle date stamps without day of week

2012-03-17 Thread Simon Thum

Hi Karl,

why don't you add something like an xx day which will probably please 
org-mode - in my tests org ignored the weekday. I concluded it's there 
for viewing convenience, and editing (C-.) always got me the right DOW.


I don't use org2ical, however.

Cheers,

Simon


On 03/05/2012 03:44 PM, Karl Voit wrote:

Hi!

I verified the behavior below with the most current git version of
Org-mode.

Whenever I call my function to export the current agenda, it
«converts» events that do have a beginning and end time to events
that span the whole day (without begin and end times at all).

,[ my LISP command to export ]
| (defun vk-export-agenda()
|   Exports monthly Org-mode agenda to agenda.ics file
|   (interactive)
|   (org-agenda-list nil nil 60)
|   (org-agenda-write ~/org/agenda.ics)
| )
`

I traced down the problem to this:

*2012-03-05 Mon 08:00-09:00  works fine
*2012-03-05 Mon 8:00-9:00  works fine too

*2012-03-05 08:00-09:00  Wrong: ends up as full day event

Unfortunately, I do have certain mechanisms that generate parts of
my Org-mode files where I skip the day of the week. Org-mode in
general is able to handle date stamps without day of week pretty
well. But whenever I export it to ics (in order to send it to
Google), I end up with a messed up online agenda.

I guess that org-agenda-write is the one to blame. It would be very
handy to me if somebody could fix that issue.

Let me know, if you need any further information!

Thank you very much!






Re: [O] [bug] org-agenda-write does not handle date stamps without day of week

2012-03-16 Thread Karl Voit
Since no followup reaction occured: is this a but that requires much
work? Or did my email just got lost in overfull inboxes? :-)

* Karl Voit devn...@karl-voit.at wrote:

 I verified the behavior below with the most current git version of
 Org-mode.

 Whenever I call my function to export the current agenda, it
 «converts» events that do have a beginning and end time to events
 that span the whole day (without begin and end times at all).

 ,[ my LISP command to export ]
| (defun vk-export-agenda()
|   Exports monthly Org-mode agenda to agenda.ics file
|   (interactive)
|   (org-agenda-list nil nil 60)
|   (org-agenda-write ~/org/agenda.ics)
| )
 `

 I traced down the problem to this:

 * 2012-03-05 Mon 08:00-09:00 works fine
 * 2012-03-05 Mon 8:00-9:00 works fine too

 * 2012-03-05 08:00-09:00 Wrong: ends up as full day event

 Unfortunately, I do have certain mechanisms that generate parts of
 my Org-mode files where I skip the day of the week. Org-mode in
 general is able to handle date stamps without day of week pretty
 well. But whenever I export it to ics (in order to send it to
 Google), I end up with a messed up online agenda.

 I guess that org-agenda-write is the one to blame. It would be very
 handy to me if somebody could fix that issue.

 Let me know, if you need any further information!

 Thank you very much!

-- 
Karl Voit




Re: [O] [bug] org-agenda-write does not handle date stamps without day of week

2012-03-16 Thread Nick Dokos
Karl Voit devn...@karl-voit.at wrote:

 Since no followup reaction occured: is this a but that requires much
 work? Or did my email just got lost in overfull inboxes? :-)
 

For me, it was a no time to work on org - stash it...

 * Karl Voit devn...@karl-voit.at wrote:
 
  I verified the behavior below with the most current git version of
  Org-mode.
 
  Whenever I call my function to export the current agenda, it
  converts that do have a beginning and end time to events
  that span the whole day (without begin and end times at all).
 
  ,[ my LISP command to export ]
 | (defun vk-export-agenda()
 |   Exports monthly Org-mode agenda to agenda.ics file
 |   (interactive)
 |   (org-agenda-list nil nil 60)
 |   (org-agenda-write ~/org/agenda.ics)
 | )
  `
 
  I traced down the problem to this:
 
  * 2012-03-05 Mon 08:00-09:00 works fine
  * 2012-03-05 Mon 8:00-9:00 works fine too
 
  * 2012-03-05 08:00-09:00 Wrong: ends up as full day event
 
  Unfortunately, I do have certain mechanisms that generate parts of
  my Org-mode files where I skip the day of the week. Org-mode in
  general is able to handle date stamps without day of week pretty
  well. But whenever I export it to ics (in order to send it to
  Google), I end up with a messed up online agenda.
 
  I guess that org-agenda-write is the one to blame. It would be very
  handy to me if somebody could fix that issue.

org-agenda-write calls org-export-icalendar which calls 
org-print-icalendar-entries
which loops over all the entries and parses them, decomposing them into 
timestamps.
Each timestamp is then passed to org-parse-time-string. It's this one that 
cannot
handle non-standard formats: it uses a regexp and assumes that all the matched 
parts
are going to be in fixed places:

,
| (defun org-parse-time-string (s optional nodefault)
|   Parse the standard Org-mode time string.
| This should be a lot faster than the normal `parse-time-string'.
| If time is not given, defaults to 0:00.  However, with optional NODEFAULT,
| hour and minute fields will be nil if not given.
|   (if (string-match org-ts-regexp0 s)
|   (list 0
|   (if (or (match-beginning 8) (not nodefault))
|   (string-to-number (or (match-string 8 s) 0)))
|   (if (or (match-beginning 7) (not nodefault))
|   (string-to-number (or (match-string 7 s) 0)))
|   (string-to-number (match-string 4 s))
|   (string-to-number (match-string 3 s))
|   (string-to-number (match-string 2 s))
|   nil nil nil)
| (error Not a standard Org-mode time string: %s s)))
`

You can evaluate the following in your *scratch* buffer to verify:

--8---cut here---start-8---
(org-parse-time-string 2012-03-05 Mon 08:00)
(0 0 8 5 3 2012 nil nil nil)

(org-parse-time-string 2012-03-05 08:00)
(0 0 0 5 3 2012 nil nil nil)
--8---cut here---end---8---

As you can see, the time has disappeared.

As to how to fix it, there are several possibilities:

1. fix your scripts that produce time stamps to include day-of-week.
2. change the callers of org-parse-time-string to make sure that DOW is 
included.
3. change just one caller: org-print-icalendar-entries to make sure that DOW is 
included.
4. change org-parse-time-string to handle a missing DOW.

There are roughly three dozen callers, so 2. is possible but a pain.
3. is simple but ugly as sin, 4. is the best way to handle it within org.

I vote for 1. where *you* have to do all the work ;-)

Nick



Re: [O] [bug] org-agenda-write does not handle date stamps without day of week

2012-03-16 Thread Karl Voit
* Nick Dokos nicholas.do...@hp.com wrote:
 Karl Voit devn...@karl-voit.at wrote:

 For me, it was a no time to work on org - stash it...

OK. I just wanted to make sure that it *is* on someone's todo list
:-)

 * Karl Voit devn...@karl-voit.at wrote:
 
  * 2012-03-05 08:00-09:00 Wrong: ends up as full day event

 org-agenda-write calls org-export-icalendar which calls 
 org-print-icalendar-entries
 which loops over all the entries and parses them, decomposing them into 
 timestamps.
 Each timestamp is then passed to org-parse-time-string. It's this one that 
 cannot
 handle non-standard formats: it uses a regexp and assumes that all the 
 matched parts
 are going to be in fixed places:

 As to how to fix it, there are several possibilities:

 1. fix your scripts that produce time stamps to include day-of-week.

Sorry, deriving DOW from an arbitrary timestamps from arbitrary data
sources is either pretty time consuming (calendar calculations) or
simply hard to calculate.

Outside Org-mode, DOW is seldom part of time-stamp data :-(

 2. change the callers of org-parse-time-string to make sure that DOW is 
 included.
 There are roughly three dozen callers, so 2. is possible but a pain.

Ack.

 3. change just one caller: org-print-icalendar-entries to make sure that DOW 
 is included.
 3. is simple but ugly as sin, 

Ouch, ack :-)

 4. change org-parse-time-string to handle a missing DOW.
 4. is the best way to handle it within org.

Full ack.

 I vote for 1. where *you* have to do all the work ;-)

YMMD :-)

If my brain would be compatible to ELISP, I'd send a patch.
Promised.

But I'll take my chance and wait for someone else (you?)
implementing 4. to resolve this issue for everybody. I really
appreciate every second you guys invest in maintaining Org-mode!

-- 
Karl Voit