Function: diary-cyclic
diary-cyclic is a byte-compiled function defined in diary-lib.el.gz.
Signature
(diary-cyclic N MONTH DAY YEAR &optional MARK)
Documentation
Cycle diary entry--entry applies every N days starting at MONTH, DAY, YEAR.
The order of the input parameters changes according to
calendar-date-style (e.g. to N DAY MONTH YEAR in the European
style). The entry can contain %d or %d%s; the %d will be
replaced by the number of repetitions since the MONTH DAY YEAR,
and %s by the ordinal ending of that number (that is, st, nd,
rd or th, as appropriate).
An optional parameter MARK specifies a face or single-character string to use when highlighting the day in the calendar.
Probably introduced at or before Emacs version 22.1.
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/diary-lib.el.gz
;; To be called from diary-sexp-entry, where DATE, ENTRY are bound.
(defun diary-cyclic (n month day year &optional mark)
"Cycle diary entry--entry applies every N days starting at MONTH, DAY, YEAR.
The order of the input parameters changes according to
`calendar-date-style' (e.g. to N DAY MONTH YEAR in the European
style). The entry can contain `%d' or `%d%s'; the %d will be
replaced by the number of repetitions since the MONTH DAY YEAR,
and %s by the ordinal ending of that number (that is, `st', `nd',
`rd' or `th', as appropriate).
An optional parameter MARK specifies a face or single-character
string to use when highlighting the day in the calendar."
(with-no-warnings (defvar date) (defvar entry))
(or (> n 0)
(user-error "Day count must be positive"))
(let* ((diff (- (calendar-absolute-from-gregorian date)
(calendar-absolute-from-gregorian
(diary-make-date month day year))))
(cycle (/ diff n)))
(and (>= diff 0) (zerop (% diff n))
(cons mark (format entry cycle (diary-ordinal-suffix cycle))))))