comparison lisp/calendar/appt.el @ 54535:f5c18c1f02ce

(appt-check): Remove superfluous progn. When finished with diary buffer: if it was not being displayed before, kill it; otherwise restore its original state. Suggested by Matthew Mundell <matt@mundell.ukfsn.org>.
author Glenn Morris <rgm@gnu.org>
date Wed, 24 Mar 2004 18:36:20 +0000
parents e3c36780d566
children a4d697f046db
comparison
equal deleted inserted replaced
54534:9739834841d5 54535:f5c18c1f02ce
323 (cur-comp-time (+ (* cur-hour 60) cur-min))) 323 (cur-comp-time (+ (* cur-hour 60) cur-min)))
324 324
325 ;; At the first check in any given day, update our 325 ;; At the first check in any given day, update our
326 ;; appointments to today's list. 326 ;; appointments to today's list.
327 327
328 (if (or force 328 (if (or force ; eg initialize, diary save
329 (null appt-prev-comp-time) ; first check 329 (null appt-prev-comp-time) ; first check
330 (< cur-comp-time appt-prev-comp-time)) ; new day 330 (< cur-comp-time appt-prev-comp-time)) ; new day
331 (condition-case nil 331 (condition-case nil
332 (progn 332 (if appt-display-diary
333 (if appt-display-diary 333 (let ((diary-hook
334 (let ((diary-hook 334 (if (assoc 'appt-make-list diary-hook)
335 (if (assoc 'appt-make-list diary-hook) 335 diary-hook
336 diary-hook 336 (cons 'appt-make-list diary-hook))))
337 (cons 'appt-make-list diary-hook)))) 337 (diary))
338 (diary)) 338 (let ((diary-display-hook 'appt-make-list)
339 (let ((diary-display-hook 'appt-make-list)) 339 (d-buff (find-buffer-visiting
340 (diary)))) 340 (substitute-in-file-name diary-file)))
341 selective)
342 (if d-buff ; diary buffer exists
343 (with-current-buffer d-buff
344 (setq selective selective-display)))
345 (diary)
346 ;; If the diary buffer existed before this command,
347 ;; restore its display state. Otherwise, kill it.
348 (if d-buff
349 ;; Displays the diary buffer.
350 (or selective (show-all-diary-entries))
351 (and
352 (setq d-buff (find-buffer-visiting
353 (substitute-in-file-name diary-file)))
354 (kill-buffer d-buff)))))
341 (error nil))) 355 (error nil)))
342 356
343 (setq appt-prev-comp-time cur-comp-time 357 (setq appt-prev-comp-time cur-comp-time
344 appt-mode-string nil 358 appt-mode-string nil
345 appt-display-count nil) 359 appt-display-count nil)
635 649
636 650
637 (defun appt-update-list () 651 (defun appt-update-list ()
638 "If the current buffer is visiting the diary, update appointments. 652 "If the current buffer is visiting the diary, update appointments.
639 This function is intended for use with `write-file-functions'." 653 This function is intended for use with `write-file-functions'."
640 (and (equal buffer-file-name (expand-file-name diary-file)) 654 (and (string-equal buffer-file-name (expand-file-name diary-file))
641 appt-timer 655 appt-timer
642 (let ((appt-display-diary nil)) 656 (let ((appt-display-diary nil))
643 (appt-check t))) 657 (appt-check t)))
644 nil) 658 nil)
645 659