Function: holiday-bahai
holiday-bahai is a byte-compiled function defined in cal-bahai.el.gz.
Signature
(holiday-bahai MONTH DAY STRING)
Documentation
Holiday on MONTH, DAY (Bahá’í) called STRING.
If MONTH, DAY (Bahá’í) is visible in the current calendar window, returns the corresponding Gregorian date in the form of the list (((month day year) STRING)). Otherwise, returns nil.
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/cal-bahai.el.gz
;;;###holiday-autoload
(defun holiday-bahai (month day string)
"Holiday on MONTH, DAY (Bahá’í) called STRING.
If MONTH, DAY (Bahá’í) is visible in the current calendar window,
returns the corresponding Gregorian date in the form of the
list (((month day year) STRING)). Otherwise, returns nil."
;; Since the calendar window shows 3 months at a time, there are
;; approx +/- 45 days either side of the central month.
;; Since the Bahai months have 19 days, this means up to +/- 3 months.
(let* ((bahai-date (calendar-bahai-from-absolute
(calendar-absolute-from-gregorian
(list displayed-month 15 displayed-year))))
(m (calendar-extract-month bahai-date))
(y (calendar-extract-year bahai-date))
date)
(unless (< m 1) ; Bahá’í calendar doesn't apply
;; Cf holiday-fixed, holiday-islamic.
;; With a +- 3 month calendar window, and 19 months per year,
;; month 16 is special. When m16 is central is when the
;; end-of-year first appears. When m1 is central, m16 is no
;; longer visible. Hence we can do a one-sided test to see if
;; m16 is visible. m16 is visible when the central month >= 13.
;; To see if other months are visible we can shift the range
;; accordingly.
(calendar-increment-month m y (- 16 month) 19)
(and (> m 12) ; Bahá’í date might be visible
(calendar-date-is-visible-p
(setq date (calendar-gregorian-from-absolute
(calendar-bahai-to-absolute (list month day y)))))
(list (list date string))))))