Function: holiday-in-range

holiday-in-range is an autoloaded and byte-compiled function defined in holidays.el.gz.

Signature

(holiday-in-range D1 D2)

Documentation

Generate a list of all holidays in range from absolute date D1 to D2.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/holidays.el.gz
(defun holiday-in-range (d1 d2)
  "Generate a list of all holidays in range from absolute date D1 to D2."
  (let* ((start (calendar-gregorian-from-absolute d1))
         (displayed-month (calendar-extract-month start))
         (displayed-year (calendar-extract-year start))
         (end (calendar-gregorian-from-absolute d2))
         (end-month (calendar-extract-month end))
         (end-year (calendar-extract-year end))
         (number-of-intervals
          (1+ (/ (calendar-interval displayed-month displayed-year
                                    end-month end-year)
                 3)))
         holidays in-range a)
    (calendar-increment-month displayed-month displayed-year 1)
    (dotimes (_ number-of-intervals)
      (setq holidays (append holidays (calendar-holiday-list)))
      (calendar-increment-month displayed-month displayed-year 3))
    (dolist (hol holidays)
      (and (car hol)
           (setq a (calendar-absolute-from-gregorian (car hol)))
           (and (<= d1 a) (<= a d2))
           (setq in-range (append (list hol) in-range))))
    in-range))