From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leo Newsgroups: gmane.emacs.bugs Subject: bug#7019: 23.2; [PATCH] fix bugs in diary/appt Date: Sun, 12 Sep 2010 11:01:19 +0100 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1284286241 10339 80.91.229.12 (12 Sep 2010 10:10:41 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 12 Sep 2010 10:10:41 +0000 (UTC) To: 7019@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Sep 12 12:10:39 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OujW9-0005kU-MK for geb-bug-gnu-emacs@m.gmane.org; Sun, 12 Sep 2010 12:10:38 +0200 Original-Received: from localhost ([127.0.0.1]:51162 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OujW8-0004O6-LD for geb-bug-gnu-emacs@m.gmane.org; Sun, 12 Sep 2010 06:10:36 -0400 Original-Received: from [140.186.70.92] (port=45072 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OujVx-0004M7-3u for bug-gnu-emacs@gnu.org; Sun, 12 Sep 2010 06:10:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OujVv-0000NY-NZ for bug-gnu-emacs@gnu.org; Sun, 12 Sep 2010 06:10:24 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:60674) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OujVv-0000NT-JK for bug-gnu-emacs@gnu.org; Sun, 12 Sep 2010 06:10:23 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OujLv-0006NU-S9; Sun, 12 Sep 2010 06:00:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Leo Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Sep 2010 10:00:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 7019 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.128428555924482 (code B ref -1); Sun, 12 Sep 2010 10:00:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 12 Sep 2010 09:59:19 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OujLC-0006Mp-RT for submit@debbugs.gnu.org; Sun, 12 Sep 2010 05:59:19 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OujLA-0006Mj-Jz for submit@debbugs.gnu.org; Sun, 12 Sep 2010 05:59:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OujNE-0007ps-KQ for submit@debbugs.gnu.org; Sun, 12 Sep 2010 06:01:25 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:35739) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OujNE-0007po-IB for submit@debbugs.gnu.org; Sun, 12 Sep 2010 06:01:24 -0400 Original-Received: from [140.186.70.92] (port=36667 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OujND-0001nF-GR for bug-gnu-emacs@gnu.org; Sun, 12 Sep 2010 06:01:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OujNC-0007pP-8P for bug-gnu-emacs@gnu.org; Sun, 12 Sep 2010 06:01:23 -0400 Original-Received: from ppsw-32.csi.cam.ac.uk ([131.111.8.132]:37733) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OujNC-0007pH-0u for bug-gnu-emacs@gnu.org; Sun, 12 Sep 2010 06:01:22 -0400 X-Cam-AntiVirus: no malware found X-Cam-SpamDetails: not scanned X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Original-Received: from cpc1-cmbg13-0-0-cust596.5-4.cable.virginmedia.com ([86.9.122.85]:52528 helo=Victoria.local) by ppsw-32.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.158]:587) with esmtpsa (PLAIN:sl392) (TLSv1:DHE-RSA-AES128-SHA:128) id 1OujN9-0005rP-2m (Exim 4.72) for bug-gnu-emacs@gnu.org (return-path ); Sun, 12 Sep 2010 11:01:20 +0100 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sun, 12 Sep 2010 06:00:03 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:40104 Archived-At: --=-=-= Emacs failed to notice me some appointments (fortunately they are not important). Here is the finding: The doc string of diary-list-entries says the return list is sorted, which is not the case. (add-hook 'diary-list-entries-hook 'diary-sort-entries) is not guaranteed to work unless that is the very last function to run. Other functions in that hook can modify the entries too, for example, diary-include-other-diary-files. The first patch fixes these issues. Another fix will be to fix the doc string to state that the returned list is not sorted. appt-make-list replies on sorted diary entries to work. The second patch explicitly sorts the list before processing. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Respect-the-doc-string-and-return-sorted-diary-entri.patch >From 1b678c6c0601f500321cfb037467f6d393f0e7eb Mon Sep 17 00:00:00 2001 From: Leo Date: Sun, 12 Sep 2010 10:36:11 +0100 Subject: [PATCH 1/2] Respect the doc string and return sorted diary entries --- lisp/calendar/diary-lib.el | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index 39354bd..3c748ac 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el @@ -187,7 +187,6 @@ you will probably also want to add `diary-mark-included-diary-files' to (setq diary-display-function 'diary-fancy-display) (add-hook 'diary-list-entries-hook 'diary-include-other-diary-files) - (add-hook 'diary-list-entries-hook 'diary-sort-entries) in your `.emacs' file to cause the fancy diary buffer to be displayed with diary entries from various included files, each day's entries sorted into @@ -789,6 +788,7 @@ LIST-ONLY is non-nil, in which case it just returns the list." (goto-char (point-min)) (run-hooks 'diary-nongregorian-listing-hook 'diary-list-entries-hook) + (diary-sort-entries) (unless list-only (if (and diary-display-function (listp diary-display-function)) -- 1.7.2 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0002-Make-appt-make-list-more-robust.patch >From 7d29e59fb61a8ef76e1c5c583a52cc25b32fba41 Mon Sep 17 00:00:00 2001 From: Leo Date: Sun, 12 Sep 2010 10:41:19 +0100 Subject: [PATCH 2/2] Make appt-make-list more robust It depends on a list of sorted diary entries to work; so explicitly sort the entries. --- lisp/calendar/appt.el | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el index b590290..53469b0 100644 --- a/lisp/calendar/appt.el +++ b/lisp/calendar/appt.el @@ -572,7 +572,8 @@ appointment package (if it is not already active)." ;; looking for entries beginning with a time. If the ;; entry begins with a time, add it to the ;; appt-time-msg-list. Then sort the list. - (let ((entry-list diary-entries-list) + (let ((entry-list (sort (copy-sequence diary-entries-list) + 'diary-entry-compare)) time-string) ;; Skip diary entries for dates before today. (while (and entry-list -- 1.7.2 --=-=-= Leo --=-=-=--