Function: appt-disp-window
appt-disp-window is a byte-compiled function defined in appt.el.gz.
Signature
(appt-disp-window MIN-TO-APP NEW-TIME APPT-MSG)
Documentation
Display appointment due in MIN-TO-APP (a string) minutes.
NEW-TIME is a string giving the current date. Displays the appointment message APPT-MSG in a separate buffer. The arguments may also be lists, where each element relates to a separate appointment.
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/appt.el.gz
(defun appt-disp-window (min-to-app new-time appt-msg)
"Display appointment due in MIN-TO-APP (a string) minutes.
NEW-TIME is a string giving the current date.
Displays the appointment message APPT-MSG in a separate buffer.
The arguments may also be lists, where each element relates to a
separate appointment."
(let ((this-window (selected-window))
(appt-disp-buf (get-buffer-create appt-buffer-name)))
;; Make sure we're not in the minibuffer before splitting the window.
;; FIXME this seems needlessly complicated?
(when (minibufferp)
(other-window 1)
(and (minibufferp) (display-multi-frame-p) (other-frame 1)))
(if (cdr (assq 'unsplittable (frame-parameters)))
;; In an unsplittable frame, use something somewhere else.
(progn
(set-buffer appt-disp-buf)
(display-buffer appt-disp-buf))
(unless (or (special-display-p (buffer-name appt-disp-buf))
(same-window-p (buffer-name appt-disp-buf)))
;; By default, split the bottom window and use the lower part.
(appt-select-lowest-window)
;; Split the window, unless it's too small to do so.
(when (>= (window-height) (* 2 window-min-height))
(select-window (split-window))))
(switch-to-buffer appt-disp-buf))
(or (listp min-to-app)
(setq min-to-app (list min-to-app)
appt-msg (list appt-msg)))
;; I don't really see the point of the new-time argument.
;; It repeatedly reminds you of the date?
;; It would make more sense if it was eg the time of the appointment.
;; Let's allow it to be a list or not independent of the other elements.
(setq new-time (ensure-list new-time))
;; FIXME Link to diary entry?
(calendar-set-mode-line
(format " %s. %s" (appt-mode-line min-to-app)
(mapconcat #'identity new-time ", ")))
(setq buffer-read-only nil
buffer-undo-list t)
(erase-buffer)
;; If we have appointments at different times, prepend the times.
(if (or (= 1 (length min-to-app))
(not (delete (car min-to-app) min-to-app)))
(insert (mapconcat #'identity appt-msg "\n"))
(dotimes (i (length appt-msg))
(insert (format "%s%sm: %s" (if (> i 0) "\n" "")
(nth i min-to-app) (nth i appt-msg)))))
(shrink-window-if-larger-than-buffer (get-buffer-window appt-disp-buf t))
(set-buffer-modified-p nil)
(setq buffer-read-only t)
(raise-frame)
(select-window this-window)))