all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Leo <sdl.web@gmail.com>
To: 7019@debbugs.gnu.org
Subject: bug#7019: 23.2; [PATCH] fix bugs in diary/appt
Date: Sun, 12 Sep 2010 11:01:19 +0100	[thread overview]
Message-ID: <m1aannxouo.fsf@cam.ac.uk> (raw)

[-- Attachment #1: Type: text/plain, Size: 672 bytes --]

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Respect-the-doc-string-and-return-sorted-diary-entri.patch --]
[-- Type: text/x-diff, Size: 1328 bytes --]

From 1b678c6c0601f500321cfb037467f6d393f0e7eb Mon Sep 17 00:00:00 2001
From: Leo <sdl.web@gmail.com>
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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Make-appt-make-list-more-robust.patch --]
[-- Type: text/x-diff, Size: 1080 bytes --]

From 7d29e59fb61a8ef76e1c5c583a52cc25b32fba41 Mon Sep 17 00:00:00 2001
From: Leo <sdl.web@gmail.com>
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


[-- Attachment #4: Type: text/plain, Size: 5 bytes --]


Leo

             reply	other threads:[~2010-09-12 10:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-12 10:01 Leo [this message]
2010-09-14  0:26 ` bug#7019: 23.2; [PATCH] fix bugs in diary/appt Glenn Morris
2010-09-14  6:42   ` Leo
2010-09-15  0:30 ` Glenn Morris
2010-09-15  2:58   ` Glenn Morris
2010-09-15  7:09   ` Leo
2010-09-15  7:19     ` Glenn Morris
2010-09-16  0:00       ` Leo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1aannxouo.fsf@cam.ac.uk \
    --to=sdl.web@gmail.com \
    --cc=7019@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.