comparison lisp/calendar/appt.el @ 110533:b799d38f522a

Merge changes from emacs-23 branch
author Chong Yidong <cyd@stupidchicken.com>
date Thu, 23 Sep 2010 15:00:31 -0400
parents 41bf9b6f3b91 ec3a9ffbd128
children 081b4ec99498
comparison
equal deleted inserted replaced
110506:2cac83f5f8bc 110533:b799d38f522a
332 cur-comp-time (+ (* 60 (nth 2 now)) (nth 1 now))) 332 cur-comp-time (+ (* 60 (nth 2 now)) (nth 1 now)))
333 ;; At first check in any day, update appointments to today's list. 333 ;; At first check in any day, update appointments to today's list.
334 (if (or force ; eg initialize, diary save 334 (if (or force ; eg initialize, diary save
335 (null appt-prev-comp-time) ; first check 335 (null appt-prev-comp-time) ; first check
336 (< cur-comp-time appt-prev-comp-time)) ; new day 336 (< cur-comp-time appt-prev-comp-time)) ; new day
337 (condition-case nil 337 (ignore-errors
338 (if appt-display-diary 338 (if appt-display-diary
339 (let ((diary-hook 339 (let ((diary-hook
340 (if (assoc 'appt-make-list diary-hook) 340 (if (assoc 'appt-make-list diary-hook)
341 diary-hook 341 diary-hook
342 (cons 'appt-make-list diary-hook)))) 342 (cons 'appt-make-list diary-hook))))
343 (diary)) 343 (diary))
344 (let* ((diary-display-function 'appt-make-list) 344 (let* ((diary-display-function 'appt-make-list)
345 (d-buff (find-buffer-visiting diary-file)) 345 (d-buff (find-buffer-visiting diary-file))
346 (selective 346 (selective
347 (if d-buff ; diary buffer exists 347 (if d-buff ; diary buffer exists
348 (with-current-buffer d-buff 348 (with-current-buffer d-buff
349 diary-selective-display)))) 349 diary-selective-display)))
350 ;; FIXME why not using diary-list-entries with 350 d-buff2)
351 ;; non-nil LIST-ONLY? 351 ;; Not displaying the diary, so we can ignore
352 (diary) 352 ;; diary-number-of-entries. Since appt.el only
353 ;; If the diary buffer existed before this command, 353 ;; works on a daily basis, no need for more entries.
354 ;; restore its display state. Otherwise, kill it. 354 ;; FIXME why not using diary-list-entries with
355 (if d-buff 355 ;; non-nil LIST-ONLY?
356 ;; Displays the diary buffer. 356 (diary 1)
357 (or selective (diary-show-all-entries)) 357 ;; If the diary buffer existed before this command,
358 (and (setq d-buff (find-buffer-visiting diary-file)) 358 ;; restore its display state. Otherwise, kill it.
359 (kill-buffer d-buff))))) 359 (and (setq d-buff2 (find-buffer-visiting diary-file))
360 (error nil))) 360 (if d-buff
361 (or selective
362 (with-current-buffer d-buff2
363 (if diary-selective-display
364 ;; diary-show-all-entries displays
365 ;; the diary buffer.
366 (diary-unhide-everything))))
367 ;; FIXME does not kill any included diary files.
368 ;; The real issue is that (diary) should not
369 ;; have the side effect of visiting all the
370 ;; diary files. It is not really appt.el's job to
371 ;; clean up this mess...
372 (kill-buffer d-buff2)))))))
361 (setq appt-prev-comp-time cur-comp-time 373 (setq appt-prev-comp-time cur-comp-time
362 appt-mode-string nil 374 appt-mode-string nil
363 appt-display-count nil) 375 appt-display-count nil)
364 ;; If there are entries in the list, and the user wants a 376 ;; If there are entries in the list, and the user wants a
365 ;; message issued, get the first time off of the list and 377 ;; message issued, get the first time off of the list and
571 ;; entry begins with a time, add it to the 583 ;; entry begins with a time, add it to the
572 ;; appt-time-msg-list. Then sort the list. 584 ;; appt-time-msg-list. Then sort the list.
573 (let ((entry-list diary-entries-list) 585 (let ((entry-list diary-entries-list)
574 (new-time-string "") 586 (new-time-string "")
575 time-string) 587 time-string)
588 ;; Below, we assume diary-entries-list was in date
589 ;; order. It is, unless something on
590 ;; diary-list-entries-hook has changed it, eg
591 ;; diary-include-other-files (bug#7019). It must be
592 ;; in date order if number = 1.
593 (and diary-list-entries-hook
594 appt-display-diary
595 (not (eq diary-number-of-entries 1))
596 (not (memq (car (last diary-list-entries-hook))
597 '(diary-sort-entries sort-diary-entries)))
598 (setq entry-list (sort entry-list 'diary-entry-compare)))
576 ;; Skip diary entries for dates before today. 599 ;; Skip diary entries for dates before today.
577 (while (and entry-list 600 (while (and entry-list
578 (calendar-date-compare 601 (calendar-date-compare
579 (car entry-list) (list (calendar-current-date)))) 602 (car entry-list) (list (calendar-current-date))))
580 (setq entry-list (cdr entry-list))) 603 (setq entry-list (cdr entry-list)))