diff options
| author | Glenn Morris | 2010-09-14 19:55:44 -0700 |
|---|---|---|
| committer | Glenn Morris | 2010-09-14 19:55:44 -0700 |
| commit | ea7f9ebfda2d09788b36bc38852efb5815828150 (patch) | |
| tree | 57a816d8d958f8e723e6328365bb6e7d3180593b | |
| parent | 1bf6d0759df7c3c535e1b4ec1e3911d3dbf0590a (diff) | |
| download | emacs-ea7f9ebfda2d09788b36bc38852efb5815828150.tar.gz emacs-ea7f9ebfda2d09788b36bc38852efb5815828150.zip | |
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)
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/calendar/appt.el | 81 |
2 files changed, 52 insertions, 34 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6972c9c743f..2e2f3b539b9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | 2010-09-15 Glenn Morris <rgm@gnu.org> | 1 | 2010-09-15 Glenn Morris <rgm@gnu.org> |
| 2 | 2 | ||
| 3 | * calendar/appt.el (appt-check): If not displaying the diary, | ||
| 4 | use (diary 1) to only get the entries we need. | ||
| 5 | (appt-make-list): Sort diary-list-entries, if we cannot guarantee | ||
| 6 | that it is in day order. (Bug#7019) | ||
| 7 | |||
| 3 | * calendar/appt.el (appt-check): Rather than showing the diary, | 8 | * calendar/appt.el (appt-check): Rather than showing the diary, |
| 4 | just turn off invisible display, and only if needed. | 9 | just turn off invisible display, and only if needed. |
| 5 | 10 | ||
diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el index 5767ef543ee..8dae260ca39 100644 --- a/lisp/calendar/appt.el +++ b/lisp/calendar/appt.el | |||
| @@ -333,40 +333,42 @@ displayed in a window: | |||
| 333 | (if (or force ; eg initialize, diary save | 333 | (if (or force ; eg initialize, diary save |
| 334 | (null appt-prev-comp-time) ; first check | 334 | (null appt-prev-comp-time) ; first check |
| 335 | (< cur-comp-time appt-prev-comp-time)) ; new day | 335 | (< cur-comp-time appt-prev-comp-time)) ; new day |
| 336 | (condition-case nil | 336 | (ignore-errors |
| 337 | (if appt-display-diary | 337 | (if appt-display-diary |
| 338 | (let ((diary-hook | 338 | (let ((diary-hook |
| 339 | (if (assoc 'appt-make-list diary-hook) | 339 | (if (assoc 'appt-make-list diary-hook) |
| 340 | diary-hook | 340 | diary-hook |
| 341 | (cons 'appt-make-list diary-hook)))) | 341 | (cons 'appt-make-list diary-hook)))) |
| 342 | (diary)) | 342 | (diary)) |
| 343 | (let* ((diary-display-function 'appt-make-list) | 343 | (let* ((diary-display-function 'appt-make-list) |
| 344 | (d-buff (find-buffer-visiting diary-file)) | 344 | (d-buff (find-buffer-visiting diary-file)) |
| 345 | (selective | 345 | (selective |
| 346 | (if d-buff ; diary buffer exists | 346 | (if d-buff ; diary buffer exists |
| 347 | (with-current-buffer d-buff | 347 | (with-current-buffer d-buff |
| 348 | diary-selective-display))) | 348 | diary-selective-display))) |
| 349 | d-buff2) | 349 | d-buff2) |
| 350 | ;; FIXME why not using diary-list-entries with | 350 | ;; Not displaying the diary, so we can ignore |
| 351 | ;; non-nil LIST-ONLY? | 351 | ;; diary-number-of-entries. Since appt.el only |
| 352 | (diary) | 352 | ;; works on a daily basis, no need for more entries. |
| 353 | ;; If the diary buffer existed before this command, | 353 | ;; FIXME why not using diary-list-entries with |
| 354 | ;; restore its display state. Otherwise, kill it. | 354 | ;; non-nil LIST-ONLY? |
| 355 | (and (setq d-buff2 (find-buffer-visiting diary-file)) | 355 | (diary 1) |
| 356 | (if d-buff | 356 | ;; If the diary buffer existed before this command, |
| 357 | (or selective | 357 | ;; restore its display state. Otherwise, kill it. |
| 358 | (with-current-buffer d-buff2 | 358 | (and (setq d-buff2 (find-buffer-visiting diary-file)) |
| 359 | (if diary-selective-display | 359 | (if d-buff |
| 360 | ;; diary-show-all-entries displays | 360 | (or selective |
| 361 | ;; the diary buffer. | 361 | (with-current-buffer d-buff2 |
| 362 | (diary-unhide-everything)))) | 362 | (if diary-selective-display |
| 363 | ;; FIXME does not kill any included diary files. | 363 | ;; diary-show-all-entries displays |
| 364 | ;; The real issue is that (diary) should not | 364 | ;; the diary buffer. |
| 365 | ;; have the side effect of visiting all the | 365 | (diary-unhide-everything)))) |
| 366 | ;; diary files. It is not really appt.el's job to | 366 | ;; FIXME does not kill any included diary files. |
| 367 | ;; clean up this mess... | 367 | ;; The real issue is that (diary) should not |
| 368 | (kill-buffer d-buff2))))) | 368 | ;; have the side effect of visiting all the |
| 369 | (error nil))) | 369 | ;; diary files. It is not really appt.el's job to |
| 370 | ;; clean up this mess... | ||
| 371 | (kill-buffer d-buff2))))))) | ||
| 370 | (setq appt-prev-comp-time cur-comp-time | 372 | (setq appt-prev-comp-time cur-comp-time |
| 371 | appt-mode-string nil | 373 | appt-mode-string nil |
| 372 | appt-display-count nil) | 374 | appt-display-count nil) |
| @@ -582,6 +584,17 @@ appointment package (if it is not already active)." | |||
| 582 | (let ((entry-list diary-entries-list) | 584 | (let ((entry-list diary-entries-list) |
| 583 | (new-time-string "") | 585 | (new-time-string "") |
| 584 | time-string) | 586 | time-string) |
| 587 | ;; Below, we assume diary-entries-list was in date | ||
| 588 | ;; order. It is, unless something on | ||
| 589 | ;; diary-list-entries-hook has changed it, eg | ||
| 590 | ;; diary-include-other-files (bug#7019). It must be | ||
| 591 | ;; in date order if number = 1. | ||
| 592 | (and diary-list-entries-hook | ||
| 593 | appt-display-diary | ||
| 594 | (not (eq diary-number-of-entries 1)) | ||
| 595 | (not (memq (car (last diary-list-entries-hook)) | ||
| 596 | '(diary-sort-entries sort-diary-entries))) | ||
| 597 | (setq entry-list (sort entry-list 'diary-entry-compare))) | ||
| 585 | ;; Skip diary entries for dates before today. | 598 | ;; Skip diary entries for dates before today. |
| 586 | (while (and entry-list | 599 | (while (and entry-list |
| 587 | (calendar-date-compare | 600 | (calendar-date-compare |