Bugfix: Deadlines with yearly repeat.
commite0bc2c7528b6b325caaf291bb6ebecb5877f099c
authorCarsten Dominik <carsten.dominik@gmail.com>
Tue, 6 Jan 2009 22:32:16 +0000 (6 23:32 +0100)
committerCarsten Dominik <carsten.dominik@gmail.com>
Tue, 6 Jan 2009 22:32:16 +0000 (6 23:32 +0100)
treecb532f6ee007c148a2412246e04f3ff7ecdc4af5
parent9dc65e4811fe9005e0488b60a30c5b555de6304c
Bugfix: Deadlines with yearly repeat.

Bernt Hansen writes:

    I've been bad and let a couple of my overhead tasks slip past
    their deadline dates.

    *** TODO Q1 Accounting: October
       DEADLINE: <2008-11-30 Mon +1y>
       - CLOSING NOTE [2008-01-30 Wed 12:18]

    This task does not show up on my agenda anymore (probably because
    the year changed).  If I change the deadline entry to this:

       DEADLINE: <2008-11-30 Mon>

    then it shows up as 37 days late.  I'm bringing this up as soon as
    I noticed it just so people are aware of this.  I have a few of
    these tasks that just dropped off my agenda (probably at the
    beginning of the year).

This interesting bug seems only to happen when the repeat is yearly,
and after crossing the December 31st year boundary.  It was a sorting
issue - Org-mode (in the function `org-closest-date') computes two
dates that are consistent with the repeater, one before and one after
the target date.  When the computation is done with a preference for
the past date (as it happens for deadlines), it should use the earlier
date.  In fact, it did choose "n1", assuming that it was the earlier
one.  This assumption does hold for daily, weekly and monthly
repeaters, but not for yearly ones.

This commits make sure that "n1" always holds the earlier date, so
that the logic at the end of the function works again.
lisp/ChangeLog
lisp/org.el