emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/emacs-23 r100044: appt.el fixes for bug#701


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-23 r100044: appt.el fixes for bug#7019.
Date: Tue, 14 Sep 2010 19:55:44 -0700
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100044
committer: Glenn Morris <address@hidden>
branch nick: emacs-23
timestamp: Tue 2010-09-14 19:55:44 -0700
message:
  appt.el fixes for bug#7019.
  * lisp/calendar/appt.el (appt-check): If not displaying the diary,
  use (diary 1) to only get the entries we need.
  (appt-make-list): Sort diary-list-entries, if we cannot guarantee
  that it is in day order.  (Bug#7019)
modified:
  lisp/ChangeLog
  lisp/calendar/appt.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-09-15 02:46:00 +0000
+++ b/lisp/ChangeLog    2010-09-15 02:55:44 +0000
@@ -1,5 +1,10 @@
 2010-09-15  Glenn Morris  <address@hidden>
 
+       * calendar/appt.el (appt-check): If not displaying the diary,
+       use (diary 1) to only get the entries we need.
+       (appt-make-list): Sort diary-list-entries, if we cannot guarantee
+       that it is in day order.  (Bug#7019)
+
        * calendar/appt.el (appt-check): Rather than showing the diary,
        just turn off invisible display, and only if needed.
 

=== modified file 'lisp/calendar/appt.el'
--- a/lisp/calendar/appt.el     2010-09-15 02:46:00 +0000
+++ b/lisp/calendar/appt.el     2010-09-15 02:55:44 +0000
@@ -333,40 +333,42 @@
         (if (or force                      ; eg initialize, diary save
                 (null appt-prev-comp-time) ; first check
                 (< cur-comp-time appt-prev-comp-time)) ; new day
-            (condition-case nil
-                (if appt-display-diary
-                    (let ((diary-hook
-                           (if (assoc 'appt-make-list diary-hook)
-                               diary-hook
-                             (cons 'appt-make-list diary-hook))))
-                      (diary))
-                  (let* ((diary-display-function 'appt-make-list)
-                         (d-buff (find-buffer-visiting diary-file))
-                         (selective
-                          (if d-buff    ; diary buffer exists
-                              (with-current-buffer d-buff
-                                diary-selective-display)))
-                         d-buff2)
-                    ;; FIXME why not using diary-list-entries with
-                    ;; non-nil LIST-ONLY?
-                    (diary)
-                    ;; If the diary buffer existed before this command,
-                    ;; restore its display state.  Otherwise, kill it.
-                    (and (setq d-buff2 (find-buffer-visiting diary-file))
-                         (if d-buff
-                             (or selective
-                                 (with-current-buffer d-buff2
-                                   (if diary-selective-display
-                                       ;; diary-show-all-entries displays
-                                       ;; the diary buffer.
-                                       (diary-unhide-everything))))
-                           ;; FIXME does not kill any included diary files.
-                           ;; The real issue is that (diary) should not
-                           ;; have the side effect of visiting all the
-                           ;; diary files.  It is not really appt.el's job to
-                           ;; clean up this mess...
-                           (kill-buffer d-buff2)))))
-              (error nil)))
+            (ignore-errors
+              (if appt-display-diary
+                  (let ((diary-hook
+                         (if (assoc 'appt-make-list diary-hook)
+                             diary-hook
+                           (cons 'appt-make-list diary-hook))))
+                    (diary))
+                (let* ((diary-display-function 'appt-make-list)
+                       (d-buff (find-buffer-visiting diary-file))
+                       (selective
+                        (if d-buff    ; diary buffer exists
+                            (with-current-buffer d-buff
+                              diary-selective-display)))
+                       d-buff2)
+                  ;; Not displaying the diary, so we can ignore
+                  ;; diary-number-of-entries.  Since appt.el only
+                  ;; works on a daily basis, no need for more entries.
+                  ;; FIXME why not using diary-list-entries with
+                  ;; non-nil LIST-ONLY?
+                  (diary 1)
+                  ;; If the diary buffer existed before this command,
+                  ;; restore its display state.  Otherwise, kill it.
+                  (and (setq d-buff2 (find-buffer-visiting diary-file))
+                       (if d-buff
+                           (or selective
+                               (with-current-buffer d-buff2
+                                 (if diary-selective-display
+                                     ;; diary-show-all-entries displays
+                                     ;; the diary buffer.
+                                     (diary-unhide-everything))))
+                         ;; FIXME does not kill any included diary files.
+                         ;; The real issue is that (diary) should not
+                         ;; have the side effect of visiting all the
+                         ;; diary files.  It is not really appt.el's job to
+                         ;; clean up this mess...
+                         (kill-buffer d-buff2)))))))
         (setq appt-prev-comp-time cur-comp-time
               appt-mode-string nil
               appt-display-count nil)
@@ -582,6 +584,17 @@
               (let ((entry-list diary-entries-list)
                     (new-time-string "")
                     time-string)
+                ;; Below, we assume diary-entries-list was in date
+                ;; order.  It is, unless something on
+                ;; diary-list-entries-hook has changed it, eg
+                ;; diary-include-other-files (bug#7019).  It must be
+                ;; in date order if number = 1.
+                (and diary-list-entries-hook
+                     appt-display-diary
+                     (not (eq diary-number-of-entries 1))
+                     (not (memq (car (last diary-list-entries-hook))
+                                '(diary-sort-entries sort-diary-entries)))
+                     (setq entry-list (sort entry-list 'diary-entry-compare)))
                 ;; Skip diary entries for dates before today.
                 (while (and entry-list
                             (calendar-date-compare


reply via email to

[Prev in Thread] Current Thread [Next in Thread]