comparison lisp/calendar/appt.el @ 91204:53108e6cea98

Merge from emacs--devo--0 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-294
author Miles Bader <miles@gnu.org>
date Thu, 06 Dec 2007 09:51:45 +0000
parents 539530fa389c b245f4378114
children 606f2d163a64
comparison
equal deleted inserted replaced
91203:db40129142b2 91204:53108e6cea98
80 80
81 (defvar diary-selective-display) 81 (defvar diary-selective-display)
82 82
83 ;;;###autoload 83 ;;;###autoload
84 (defcustom appt-issue-message t 84 (defcustom appt-issue-message t
85 "*Non-nil means check for appointments in the diary buffer. 85 "Non-nil means check for appointments in the diary buffer.
86 To be detected, the diary entry must have the format described in the 86 To be detected, the diary entry must have the format described in the
87 documentation of the function `appt-check'." 87 documentation of the function `appt-check'."
88 :type 'boolean 88 :type 'boolean
89 :group 'appt) 89 :group 'appt)
90 90
92 "use the function `appt-activate', and the \ 92 "use the function `appt-activate', and the \
93 variable `appt-display-format' instead." "22.1") 93 variable `appt-display-format' instead." "22.1")
94 94
95 ;;;###autoload 95 ;;;###autoload
96 (defcustom appt-message-warning-time 12 96 (defcustom appt-message-warning-time 12
97 "*Time in minutes before an appointment that the warning begins." 97 "Time in minutes before an appointment that the warning begins."
98 :type 'integer 98 :type 'integer
99 :group 'appt) 99 :group 'appt)
100 100
101 ;;;###autoload 101 ;;;###autoload
102 (defcustom appt-audible t 102 (defcustom appt-audible t
103 "*Non-nil means beep to indicate appointment." 103 "Non-nil means beep to indicate appointment."
104 :type 'boolean 104 :type 'boolean
105 :group 'appt) 105 :group 'appt)
106 106
107 ;;;###autoload 107 ;;;###autoload
108 (defcustom appt-visible t 108 (defcustom appt-visible t
109 "*Non-nil means display appointment message in echo area. 109 "Non-nil means display appointment message in echo area.
110 This variable is only relevant if `appt-msg-window' is nil." 110 This variable is only relevant if `appt-msg-window' is nil."
111 :type 'boolean 111 :type 'boolean
112 :group 'appt) 112 :group 'appt)
113 113
114 (make-obsolete-variable 'appt-visible 'appt-display-format "22.1") 114 (make-obsolete-variable 'appt-visible 'appt-display-format "22.1")
115 115
116 ;;;###autoload 116 ;;;###autoload
117 (defcustom appt-msg-window t 117 (defcustom appt-msg-window t
118 "*Non-nil means display appointment message in another window. 118 "Non-nil means display appointment message in another window.
119 If non-nil, this variable overrides `appt-visible'." 119 If non-nil, this variable overrides `appt-visible'."
120 :type 'boolean 120 :type 'boolean
121 :group 'appt) 121 :group 'appt)
122 122
123 (make-obsolete-variable 'appt-msg-window 'appt-display-format "22.1") 123 (make-obsolete-variable 'appt-msg-window 'appt-display-format "22.1")
142 :group 'appt 142 :group 'appt
143 :version "22.1") 143 :version "22.1")
144 144
145 ;;;###autoload 145 ;;;###autoload
146 (defcustom appt-display-mode-line t 146 (defcustom appt-display-mode-line t
147 "*Non-nil means display minutes to appointment and time on the mode line. 147 "Non-nil means display minutes to appointment and time on the mode line.
148 This is in addition to any other display of appointment messages." 148 This is in addition to any other display of appointment messages."
149 :type 'boolean 149 :type 'boolean
150 :group 'appt) 150 :group 'appt)
151 151
152 ;;;###autoload 152 ;;;###autoload
153 (defcustom appt-display-duration 10 153 (defcustom appt-display-duration 10
154 "*The number of seconds an appointment message is displayed. 154 "The number of seconds an appointment message is displayed.
155 Only relevant if reminders are to be displayed in their own window." 155 Only relevant if reminders are to be displayed in their own window."
156 :type 'integer 156 :type 'integer
157 :group 'appt) 157 :group 'appt)
158 158
159 ;;;###autoload 159 ;;;###autoload
160 (defcustom appt-display-diary t 160 (defcustom appt-display-diary t
161 "*Non-nil displays the diary when the appointment list is first initialized. 161 "Non-nil displays the diary when the appointment list is first initialized.
162 This will occur at midnight when the appointment list is updated." 162 This will occur at midnight when the appointment list is updated."
163 :type 'boolean 163 :type 'boolean
164 :group 'appt) 164 :group 'appt)
165 165
166 (defcustom appt-display-interval 3 166 (defcustom appt-display-interval 3
167 "*Number of minutes to wait between checking the appointment list." 167 "Number of minutes to wait between checking the appointment list."
168 :type 'integer 168 :type 'integer
169 :group 'appt) 169 :group 'appt)
170 170
171 (defcustom appt-disp-window-function 'appt-disp-window 171 (defcustom appt-disp-window-function 'appt-disp-window
172 "Function called to display appointment window. 172 "Function called to display appointment window.
434 434
435 (defun appt-disp-window (min-to-app new-time appt-msg) 435 (defun appt-disp-window (min-to-app new-time appt-msg)
436 "Display appointment message APPT-MSG in a separate buffer. 436 "Display appointment message APPT-MSG in a separate buffer.
437 The appointment is due in MIN-TO-APP (a string) minutes. 437 The appointment is due in MIN-TO-APP (a string) minutes.
438 NEW-TIME is a string giving the date." 438 NEW-TIME is a string giving the date."
439 (require 'electric) 439 ;; Make sure we're not in the minibuffer before splitting the window.
440 440 ;; FIXME this seems needlessly complicated?
441 ;; Make sure we're not in the minibuffer 441 (when (minibufferp)
442 ;; before splitting the window. 442 (other-window 1)
443 443 (and (minibufferp) (display-multi-frame-p) (other-frame 1)))
444 (if (equal (selected-window) (minibuffer-window))
445 (if (other-window 1)
446 (select-window (other-window 1))
447 (if (display-multi-frame-p)
448 (select-frame (other-frame 1)))))
449
450 (let ((this-window (selected-window)) 444 (let ((this-window (selected-window))
451 (appt-disp-buf (set-buffer (get-buffer-create appt-buffer-name)))) 445 (appt-disp-buf (set-buffer (get-buffer-create appt-buffer-name))))
452
453 (if (cdr (assq 'unsplittable (frame-parameters))) 446 (if (cdr (assq 'unsplittable (frame-parameters)))
454 ;; In an unsplittable frame, use something somewhere else. 447 ;; In an unsplittable frame, use something somewhere else.
455 (display-buffer appt-disp-buf) 448 (display-buffer appt-disp-buf)
456 (unless (or (special-display-p (buffer-name appt-disp-buf)) 449 (unless (or (special-display-p (buffer-name appt-disp-buf))
457 (same-window-p (buffer-name appt-disp-buf))) 450 (same-window-p (buffer-name appt-disp-buf)))
487 (bottom-edge (nth 3 (window-edges)))) 480 (bottom-edge (nth 3 (window-edges))))
488 (walk-windows (lambda (w) 481 (walk-windows (lambda (w)
489 (let ((next-bottom-edge (nth 3 (window-edges w)))) 482 (let ((next-bottom-edge (nth 3 (window-edges w))))
490 (when (< bottom-edge next-bottom-edge) 483 (when (< bottom-edge next-bottom-edge)
491 (setq bottom-edge next-bottom-edge 484 (setq bottom-edge next-bottom-edge
492 lowest-window w))))) 485 lowest-window w)))) 'nomini)
493 (select-window lowest-window))) 486 (select-window lowest-window)))
494 487
495 (defconst appt-time-regexp 488 (defconst appt-time-regexp
496 "[0-9]?[0-9]\\(h\\([0-9][0-9]\\)?\\|[:.][0-9][0-9]\\)\\(am\\|pm\\)?") 489 "[0-9]?[0-9]\\(h\\([0-9][0-9]\\)?\\|[:.][0-9][0-9]\\)\\(am\\|pm\\)?")
497 490