hsitz / VimOrganizer

VimOrganizer is partly a clone of Emacs' Org-mode, and partly a front end to Org-mode itself. Do Org in Vim.
http://vimeo.com/31531308
518 stars 67 forks source link

Some dates throw agenda time grid way off (errors) #48

Open progo opened 12 years ago

progo commented 12 years ago

Encountered issues with a date. Small test case:

* bug is supposed to be here.
** with any random text
   :<2012-09-05 Wed 14:07>

Running ,aga (agenda for current week) will throw following errors (split some of the lines for readability):

Error detected while processing function OrgAgendaDashboard..
    <SNR>80_RunCustom..OrgRunAgenda..<SNR>80_DateDictToScreen..
    <SNR>80_PlaceTimeGrid:
line    8:
E684: list index out of range: 8
E116: Invalid arguments for function matchstr(lines[i],'\%24c\d\d:\d\d') &&
    i < len(lines))
E15: Invalid expression: (matchstr(lines[i],'\%24c\d\d:\d\d') &&
    i < len(lines))

As the date looks perfectly normal (org-capture) I'm pretty confused about this.

hsitz commented 12 years ago

On Wed, Sep 5, 2012 at 7:56 AM, Mikael notifications@github.com wrote:

Encountered issues with a date. Small test case:

  • bug is supposed to be here. \ with any random text :<2012-09-05 Wed 14:07>

[. . . ]

As the date looks perfectly normal (org-capture) I'm pretty confused about

this.

Mikael --

You're right, that does seem strange. I haven't seen anything like that before, but it's easily reproducible and it should be easy to track down, I'll take a look at it later today.

Thanks,

Herb

hsitz commented 12 years ago

On Wed, Sep 5, 2012 at 7:56 AM, Mikael notifications@github.com wrote:

Error detected while processing function OrgAgendaDashboard..

80_RunCustom..OrgRunAgenda..80_DateDictToScreen.. 80_PlaceTimeGrid: line 8: E684: list index out of range: 8 E116: Invalid arguments for function matchstr(lines[i],'\%24c\d\d:\d\d') && i < len(lines)) E15: Invalid expression: (matchstr(lines[i],'\%24c\d\d:\d\d') && i < len(lines)) As the date looks perfectly normal (org-capture) I'm pretty confused about this. Mikael --

Turns out the error is when you're specifying times as well as date, occurs in current day (or any day with time events if you're doing single day view in agenda) and timegrid function is on (which it is by default).

The error message was pretty spot on, it looks like it was misordered conditions in the while statement, since the first condition is intended to short-circuit the 'AND' and exit the while loop.

Changing the while statement in PlaceTimeGrid function to this should fix it:

    while ((i < len(lines)) && matchstr(lines[i],'\%24c\d\d:\d\d') )

Please let me know if that does indeed fix the problem.

Regards,

Herb

progo commented 12 years ago

On Wed, Sep 5, 2012 at 9:30 PM, hsitz notifications@github.com wrote:

On Wed, Sep 5, 2012 at 7:56 AM, Mikael notifications@github.com wrote:

Error detected while processing function OrgAgendaDashboard..

80_RunCustom..OrgRunAgenda..80_DateDictToScreen.. 80_PlaceTimeGrid: line 8: E684: list index out of range: 8 E116: Invalid arguments for function matchstr(lines[i],'\%24c\d\d:\d\d') && i < len(lines)) E15: Invalid expression: (matchstr(lines[i],'\%24c\d\d:\d\d') && i < len(lines)) As the date looks perfectly normal (org-capture) I'm pretty confused about this. Mikael --

Turns out the error is when you're specifying times as well as date, occurs in current day (or any day with time events if you're doing single day view in agenda) and timegrid function is on (which it is by default).

The error message was pretty spot on, it looks like it was misordered conditions in the while statement, since the first condition is intended to short-circuit the 'AND' and exit the while loop.

Changing the while statement in PlaceTimeGrid function to this should fix it:

while ((i < len(lines)) && matchstr(lines[i],'\%24c\d\d:\d\d') )

Please let me know if that does indeed fix the problem.

Regards,

Herb

— Reply to this email directly or view it on GitHub.

Yes, that change did indeed fix the minimal test org and my greater org files as well.

Thank you for quick respoonse on the matter.