From 359bff6712a073903ad77086637bb125dd0342e5 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 24 Mar 2004 18:36:20 +0000 Subject: [PATCH] (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 . --- lisp/calendar/appt.el | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el index d002b6fd212..002aec878ca 100644 --- a/lisp/calendar/appt.el +++ b/lisp/calendar/appt.el @@ -325,19 +325,33 @@ displayed in a window: ;; At the first check in any given day, update our ;; appointments to today's list. - (if (or force + (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 - (progn - (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-hook 'appt-make-list)) - (diary)))) + (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-hook 'appt-make-list) + (d-buff (find-buffer-visiting + (substitute-in-file-name diary-file))) + selective) + (if d-buff ; diary buffer exists + (with-current-buffer d-buff + (setq selective selective-display))) + (diary) + ;; If the diary buffer existed before this command, + ;; restore its display state. Otherwise, kill it. + (if d-buff + ;; Displays the diary buffer. + (or selective (show-all-diary-entries)) + (and + (setq d-buff (find-buffer-visiting + (substitute-in-file-name diary-file))) + (kill-buffer d-buff))))) (error nil))) (setq appt-prev-comp-time cur-comp-time @@ -637,7 +651,7 @@ hour and minute parts." (defun appt-update-list () "If the current buffer is visiting the diary, update appointments. This function is intended for use with `write-file-functions'." - (and (equal buffer-file-name (expand-file-name diary-file)) + (and (string-equal buffer-file-name (expand-file-name diary-file)) appt-timer (let ((appt-display-diary nil)) (appt-check t))) -- 2.39.2