Function: diary-remind

diary-remind is a byte-compiled function defined in diary-lib.el.gz.

Signature

(diary-remind SEXP DAYS &optional MARKING)

Documentation

Provide a reminder of a diary entry.

SEXP is a diary-sexp. DAYS is either a single number or a list of numbers indicating the number(s) of days before the event that the warning(s) should occur on. A negative number -DAYS has the same meaning as a list (1 2 ... DAYS). If the current date is (one of) DAYS before the event indicated by SEXP, then this function returns a suitable message (as specified by diary-remind-message).

In addition to the reminders beforehand, the diary entry also appears on the date itself.

A diary-nonmarking-symbol at the beginning of the line of the diary-remind entry specifies that the diary entry (not the reminder) is non-marking. Marking of reminders is independent of whether the entry itself is a marking or nonmarking; if optional parameter MARKING is non-nil then the reminders are marked on the calendar.

View in manual

Probably introduced at or before Emacs version 23.1.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/diary-lib.el.gz
(defun diary-remind (sexp days &optional marking)
  "Provide a reminder of a diary entry.
SEXP is a diary-sexp.  DAYS is either a single number or a list
of numbers indicating the number(s) of days before the event that
the warning(s) should occur on.  A negative number -DAYS has the
same meaning as a list (1 2 ... DAYS).  If the current date
is (one of) DAYS before the event indicated by SEXP, then this function
returns a suitable message (as specified by `diary-remind-message').

In addition to the reminders beforehand, the diary entry also
appears on the date itself.

A `diary-nonmarking-symbol' at the beginning of the line of the
`diary-remind' entry specifies that the diary entry (not the
reminder) is non-marking.  Marking of reminders is independent of
whether the entry itself is a marking or nonmarking; if optional
parameter MARKING is non-nil then the reminders are marked on the
calendar."
  ;; `date' has a value at this point, from diary-sexp-entry.
  (with-no-warnings (defvar date))
  ;; Convert a negative number to a list of days.
  (and (integerp days)
       (< days 0)
       (setq days (number-sequence 1 (- days))))
  (calendar-dlet ((diary-entry (eval sexp)))
    (cond
     ;; Diary entry applies on date.
     ((and diary-entry
           (or (not diary-marking-entries-flag) diary-marking-entry-flag))
      diary-entry)
     ;; Diary entry may apply to `days' before date.
     ((and (integerp days)
           (not diary-entry)      ; diary entry does not apply to date
           (or (not diary-marking-entries-flag) marking))
      ;; Adjust date, and re-evaluate.
      (let ((date (calendar-gregorian-from-absolute
                   (+ (calendar-absolute-from-gregorian date) days))))
        (when (setq diary-entry (eval sexp))
          ;; Discard any mark portion from diary-anniversary, etc.
          (if (consp diary-entry) (setq diary-entry (cdr diary-entry)))
          (calendar-dlet ((days days))
            (mapconcat #'eval diary-remind-message "")))))
     ;; Diary entry may apply to one of a list of days before date.
     ((and (listp days) days)
      (or (diary-remind sexp (car days) marking)
          (diary-remind sexp (cdr days) marking))))))