;; Configuration for the South African Public Holidays. Accounts for ;; weekends. Dates sourced from Act No. 36 of 1994 ;; (http://www.gov.za/gazette/acts/1994/a36-94.htm). ;; ;; Suitable for a .emacs file. Enable with a line like: ;; ;; (setq other-holidays (append south-african-public-holidays ;; other-holidays)) ;; ;; or, to override US holidays, like: ;; ;; (setq general-holidays south-african-public-holidays) ;; ;; Information appreciated as to where the holiday for the 25th of ;; December falls when, as in 2005, it is a Sunday. (defun abs-easter (displayed-year) "Return the absolute date of Easter Sunday in DISPLAYED-YEAR. Taken directly from `holiday-easter-etc' in holidays.el. Perhaps it would be better to have this function there." (let* ((century (1+ (/ displayed-year 100))) (shifted-epact ;; Age of moon for April 5... (% (+ 14 (* 11 (% displayed-year 19)) ;; ...by Nicaean rule (- ;; ...corrected for the Gregorian century rule (/ (* 3 century) 4)) (/ ;; ...corrected for Metonic cycle inaccuracy. (+ 5 (* 8 century)) 25) (* 30 century)) ;; Keeps value positive. 30)) (adjusted-epact ;; Adjust for 29.5 day month. (if (or (= shifted-epact 0) (and (= shifted-epact 1) (< 10 (% displayed-year 19)))) (1+ shifted-epact) shifted-epact)) (paschal-moon ;; Day after the full moon on or after March 21. (- (calendar-absolute-from-gregorian (list 4 19 displayed-year)) adjusted-epact))) (calendar-dayname-on-or-before 0 (+ paschal-moon 7)))) (eval-when-compile ;; free vars - should these be defined by calendar? (defvar year) (defvar date)) ;; SA holidays (defun saph-skip-sunday (date) "Return the Monday following DATE if DATE is a Sunday, else DATE. DATE must be a (month day year) list." (let* ((abs-date (calendar-absolute-from-gregorian date)) (day (calendar-day-name date))) (if (equal day "Sunday") (calendar-gregorian-from-absolute (calendar-dayname-on-or-before 1 ; Monday (+ 7 abs-date))) date))) (defvar south-african-public-holidays '((holiday-sexp '(saph-skip-sunday `(1 1 ,year)) "SA New Year's Day") (holiday-sexp '(saph-skip-sunday `(3 21 ,year)) "SA Human Rights Day") (holiday-sexp '(calendar-gregorian-from-absolute (- (abs-easter year) 2)) "SA Good Friday") (holiday-sexp '(calendar-gregorian-from-absolute (1+ (abs-easter year))) "SA Family Day") (holiday-sexp '(saph-skip-sunday `(5 1 ,year)) "SA Workers' Day") (holiday-sexp '(saph-skip-sunday `(6 16 ,year)) "SA Youth Day") (holiday-sexp '(saph-skip-sunday `(8 9 ,year)) "SA National Women's Day") (holiday-sexp '(saph-skip-sunday `(9 24 ,year)) "SA Heritage Day") (holiday-sexp '(saph-skip-sunday `(12 16 ,year)) "SA Day of Reconciliation") ;; FIX where does the holiday fall when the 25th Dec is a Sunday? (holiday-sexp '(saph-skip-sunday `(12 25 ,year)) "SA Christmas Day") (holiday-sexp '(saph-skip-sunday `(12 26 ,year)) "SA Day of Goodwill")) "*South African public holidays, according to Act No. 36 of 1994 (http://www.gov.za/gazette/acts/1994/a36-94.htm).")