>From c4cfef7043ff51c48834d55cf0b163fb95f3f5d5 Mon Sep 17 00:00:00 2001 From: Ivan Kanis Date: Thu, 24 Mar 2011 18:32:23 +0100 Subject: [PATCH 01/13] remove full-check and mode-line-only These two variables just make the code more complex than it should be. The main interest is to have the display refresh at n mod time. Remove appt-now-displayed since it's not used anymore. --- appt.el | 23 +++++------------------ 1 files changed, 5 insertions(+), 18 deletions(-) diff --git a/appt.el b/appt.el index 4c318dc..e2b1158 100644 --- a/appt.el +++ b/appt.el @@ -217,9 +217,6 @@ Only used if `appt-display-mode-line' is non-nil.") "Time of day (mins since midnight) at which we last checked appointments. A nil value forces the diary file to be (re-)checked for appointments.") -(defvar appt-now-displayed nil - "Non-nil when we have started notifying about a appointment that is near.") - (defvar appt-display-count nil "Internal variable used to count number of consecutive reminders.") @@ -314,17 +311,7 @@ displayed in a window: (let* ((min-to-app -1) (prev-appt-mode-string appt-mode-string) (prev-appt-display-count (or appt-display-count 0)) - ;; Non-nil means do a full check for pending appointments and - ;; display in whatever ways the user has selected. When no - ;; appointment is being displayed, we always do a full check. - (full-check - (or (not appt-now-displayed) - ;; This is true every appt-display-interval minutes. - (zerop (mod prev-appt-display-count appt-display-interval)))) - ;; Non-nil means only update the interval displayed in the mode line. - (mode-line-only (unless full-check appt-now-displayed)) now cur-comp-time appt-comp-time appt-warn-time) - (when (or full-check mode-line-only) (save-excursion ;; Convert current time to minutes after midnight (12.01am = 1). (setq now (decode-time) @@ -402,10 +389,10 @@ displayed in a window: ;; appt-message-warning time. (when (and (<= min-to-app appt-warn-time) (>= min-to-app 0)) - (setq appt-now-displayed t - appt-display-count (1+ prev-appt-display-count)) - (unless mode-line-only - (appt-display-message (cadr (car appt-time-msg-list)) + (setq appt-display-count (1+ prev-appt-display-count)) + ;; This is true every appt-display-interval minutes. + (if (zerop (mod prev-appt-display-count appt-display-interval)) + (appt-display-message (cadr (car appt-time-msg-list)) min-to-app)) (when appt-display-mode-line (setq appt-mode-string @@ -426,7 +413,7 @@ displayed in a window: (force-mode-line-update t) ;; If the string now has a notification, redisplay right now. (if appt-mode-string - (sit-for 0)))))))) + (sit-for 0))))))) (defun appt-disp-window (min-to-app new-time appt-msg) "Display appointment due in MIN-TO-APP (a string) minutes. -- 1.7.1