comparison lisp/calendar/appt.el @ 54070:e3c36780d566

(appt-display-format): Change default to'ignore, for backwards compatability. (appt-display-message): If appt-display-format is 'ignore, respect old vars appt-msg-window and appt-visible. (appt-activate): Don't depend on return value of cancel-timer.
author Glenn Morris <rgm@gnu.org>
date Thu, 19 Feb 2004 01:12:21 +0000
parents 761988ba350d
children f5c18c1f02ce
comparison
equal deleted inserted replaced
54069:39833fcaf41c 54070:e3c36780d566
41 ;;; To activate this package, simply use (appt-activate 1). 41 ;;; To activate this package, simply use (appt-activate 1).
42 ;;; A `diary-file' with appointments of the format described in the 42 ;;; A `diary-file' with appointments of the format described in the
43 ;;; documentation of the function `appt-check' is required. 43 ;;; documentation of the function `appt-check' is required.
44 ;;; Relevant customizable variables are also listed in the 44 ;;; Relevant customizable variables are also listed in the
45 ;;; documentation of that function. 45 ;;; documentation of that function.
46 ;;; 46 ;;;
47 ;;; Today's appointment list is initialized from the diary when this 47 ;;; Today's appointment list is initialized from the diary when this
48 ;;; package is activated. Additionally, the appointments list is 48 ;;; package is activated. Additionally, the appointments list is
49 ;;; recreated automatically at 12:01am for those who do not logout 49 ;;; recreated automatically at 12:01am for those who do not logout
50 ;;; every day or are programming late. It is also updated when the 50 ;;; every day or are programming late. It is also updated when the
51 ;;; `diary-file' is saved. Calling `appt-check' with an argument forces 51 ;;; `diary-file' is saved. Calling `appt-check' with an argument forces
119 :group 'appt) 119 :group 'appt)
120 120
121 (make-obsolete-variable 'appt-msg-window 'appt-display-format "21.4") 121 (make-obsolete-variable 'appt-msg-window 'appt-display-format "21.4")
122 122
123 ;; TODO - add popup. 123 ;; TODO - add popup.
124 (defcustom appt-display-format (cond (appt-msg-window 'window) 124 (defcustom appt-display-format 'ignore
125 (appt-visible 'echo)
126 (t nil))
127 "How appointment reminders should be displayed. 125 "How appointment reminders should be displayed.
128 The options are: 126 The options are:
129 window - use a separate window 127 window - use a separate window
130 echo - use the echo area 128 echo - use the echo area
131 nil - no visible reminder. 129 nil - no visible reminder.
132 See also `appt-audible' and `appt-display-mode-line'." 130 See also `appt-audible' and `appt-display-mode-line'.
131
132 The default value is 'ignore, which means to fall back on the value
133 of the (obsolete) variables `appt-msg-window' and `appt-visible'."
133 :type '(choice 134 :type '(choice
134 (const :tag "Separate window" window) 135 (const :tag "Separate window" window)
135 (const :tag "Echo-area" echo) 136 (const :tag "Echo-area" echo)
136 (const :tag "No visible display" nil)) 137 (const :tag "No visible display" nil))
137 :group 'appt 138 :group 'appt
220 (defun appt-display-message (string mins) 221 (defun appt-display-message (string mins)
221 "Display a reminder about an appointment. 222 "Display a reminder about an appointment.
222 The string STRING describes the appointment, due in integer MINS minutes. 223 The string STRING describes the appointment, due in integer MINS minutes.
223 The format of the visible reminder is controlled by `appt-display-format'. 224 The format of the visible reminder is controlled by `appt-display-format'.
224 The variable `appt-audible' controls the audible reminder." 225 The variable `appt-audible' controls the audible reminder."
225 (cond ((eq appt-display-format 'window) 226 ;; let binding for backwards compatability. Remove when obsolete
226 (funcall appt-disp-window-function 227 ;; vars appt-msg-window and appt-visible are dropped.
227 (number-to-string mins) 228 (let ((appt-display-format
228 (format-time-string "%a %b %e " (current-time)) 229 (if (eq appt-display-format 'ignore)
229 string) 230 (cond (appt-msg-window 'window)
230 (run-at-time (format "%d sec" appt-display-duration) 231 (appt-visible 'echo))
231 nil 232 appt-display-format)))
232 appt-delete-window-function)) 233 (cond ((eq appt-display-format 'window)
233 ((eq appt-display-format 'echo) 234 (funcall appt-disp-window-function
234 (message "%s" string))) 235 (number-to-string mins)
235 (if appt-audible (beep 1))) 236 (format-time-string "%a %b %e " (current-time))
237 string)
238 (run-at-time (format "%d sec" appt-display-duration)
239 nil
240 appt-delete-window-function))
241 ((eq appt-display-format 'echo)
242 (message "%s" string)))
243 (if appt-audible (beep 1))))
236 244
237 245
238 (defun appt-check (&optional force) 246 (defun appt-check (&optional force)
239 "Check for an appointment and update any reminder display. 247 "Check for an appointment and update any reminder display.
240 If optional argument FORCE is non-nil, reparse the diary file for 248 If optional argument FORCE is non-nil, reparse the diary file for
646 (setq appt-active (if arg (> (prefix-numeric-value arg) 0) 654 (setq appt-active (if arg (> (prefix-numeric-value arg) 0)
647 (not appt-active))) 655 (not appt-active)))
648 (remove-hook 'write-file-functions 'appt-update-list) 656 (remove-hook 'write-file-functions 'appt-update-list)
649 (or global-mode-string (setq global-mode-string '(""))) 657 (or global-mode-string (setq global-mode-string '("")))
650 (delq 'appt-mode-string global-mode-string) 658 (delq 'appt-mode-string global-mode-string)
651 (and appt-timer 659 (when appt-timer
652 (cancel-timer appt-timer) 660 (cancel-timer appt-timer)
653 (setq appt-timer nil)) 661 (setq appt-timer nil))
654 (when appt-active 662 (when appt-active
655 (add-hook 'write-file-functions 'appt-update-list) 663 (add-hook 'write-file-functions 'appt-update-list)
656 (setq appt-timer (run-at-time t 60 'appt-check) 664 (setq appt-timer (run-at-time t 60 'appt-check)
657 global-mode-string 665 global-mode-string
658 (append global-mode-string '(appt-mode-string))) 666 (append global-mode-string '(appt-mode-string)))