Subject: Re: bug#7019: 23.2; [PATCH] fix bugs in diary/appt

From: Glenn Morris <[email-masked]>
Date: Mon, 13 Sep 2010 20:26:03 -0400

Leo wrote:

> The doc string of diary-list-entries says the return list is sorted,

Where does it say that? Oh, I guess you might mean:

  Returns a list of all relevant diary entries found, if any, in order
  by date.

Which is true unless include files are involved. Note it does not mean
that entries are also sorted by time of day. I don't think sorting by
default is the right solution. I might just mention in the docs that
if include files are used, the order will day order for the entries
from any given file, then by the order in which the include files were
processed. Some people might want it that way (eg not sorted by time
of day), and those who don't are probably aready using
diary-sort-entries. The fact that the entries are in day order is
really just a consequence of how the code is implemented, rather than
a deliberate choice.

> (add-hook 'diary-list-entries-hook 'diary-sort-entries) is not
> guaranteed to work unless that is the very last function to run.

OK, I think that should just be pointed out in the docs.
(The manual sort of does this without being explicit.)

> appt-make-list replies on sorted diary entries to work.

Looks like it relies on them being sorted in _day_ order, but not in
_time_ order within any given day. Again, this is true unless include
files are involved. I guess this is why nobody noticed till now. I'll
fix that somehow.