1 |
;;; holidays.el --- holiday functions for the calendar package |
;;; holidays.el --- holiday functions for the calendar package |
2 |
|
|
3 |
;; Copyright (C) 1989, 90, 92, 93, 94, 1997 Free Software Foundation, Inc. |
;; Copyright (C) 1989, 1990, 1992, 1993, 1994, 1997, 2004 Free |
4 |
|
;; Software Foundation, Inc. |
5 |
|
|
6 |
;; Author: Edward M. Reingold <reingold@cs.uiuc.edu> |
;; Author: Edward M. Reingold <reingold@cs.uiuc.edu> |
7 |
|
;; Maintainer: Glenn Morris <gmorris@ast.cam.ac.uk> |
8 |
;; Keywords: holidays, calendar |
;; Keywords: holidays, calendar |
9 |
|
|
10 |
;; This file is part of GNU Emacs. |
;; This file is part of GNU Emacs. |
400 |
(string (if date (eval string)))) |
(string (if date (eval string)))) |
401 |
(list (list date string))))))) |
(list (list date string))))))) |
402 |
|
|
403 |
(defun holiday-advent () |
(defun holiday-advent (n string) |
404 |
"Date of Advent, if visible in calendar window." |
"Date of Nth day after advent (named STRING), if visible in calendar window." |
405 |
(let ((year displayed-year) |
(let ((year displayed-year) |
406 |
(month displayed-month)) |
(month displayed-month)) |
407 |
(increment-calendar-month month year -1) |
(increment-calendar-month month year -1) |
408 |
(let ((advent (calendar-gregorian-from-absolute |
(let ((advent (calendar-gregorian-from-absolute |
409 |
(calendar-dayname-on-or-before 0 |
(+ n |
410 |
(calendar-absolute-from-gregorian |
(calendar-dayname-on-or-before |
411 |
(list 12 3 year)))))) |
0 |
412 |
|
(calendar-absolute-from-gregorian |
413 |
|
(list 12 3 year))))))) |
414 |
(if (calendar-date-is-visible-p advent) |
(if (calendar-date-is-visible-p advent) |
415 |
(list (list advent "Advent")))))) |
(list (list advent string)))))) |
416 |
|
|
417 |
(defun holiday-easter-etc () |
(defun holiday-easter-etc (n string) |
418 |
"List of dates related to Easter, as visible in calendar window." |
"Date of Nth day after Easter (named STRING), if visible in calendar window." |
419 |
(if (and (> displayed-month 5) (not all-christian-calendar-holidays)) |
(let* ((century (1+ (/ displayed-year 100))) |
420 |
nil;; Ash Wednesday, Good Friday, and Easter are not visible. |
(shifted-epact ;; Age of moon for April 5... |
421 |
(let* ((century (1+ (/ displayed-year 100))) |
(% (+ 14 (* 11 (% displayed-year 19));; ...by Nicaean rule |
422 |
(shifted-epact ;; Age of moon for April 5... |
(- ;; ...corrected for the Gregorian century rule |
423 |
(% (+ 14 (* 11 (% displayed-year 19));; ...by Nicaean rule |
(/ (* 3 century) 4)) |
424 |
(- ;; ...corrected for the Gregorian century rule |
(/ ;; ...corrected for Metonic cycle inaccuracy. |
425 |
(/ (* 3 century) 4)) |
(+ 5 (* 8 century)) 25) |
426 |
(/ ;; ...corrected for Metonic cycle inaccuracy. |
(* 30 century));; Keeps value positive. |
427 |
(+ 5 (* 8 century)) 25) |
30)) |
428 |
(* 30 century));; Keeps value positive. |
(adjusted-epact ;; Adjust for 29.5 day month. |
429 |
30)) |
(if (or (= shifted-epact 0) |
430 |
(adjusted-epact ;; Adjust for 29.5 day month. |
(and (= shifted-epact 1) (< 10 (% displayed-year 19)))) |
431 |
(if (or (= shifted-epact 0) |
(1+ shifted-epact) |
432 |
(and (= shifted-epact 1) (< 10 (% displayed-year 19)))) |
shifted-epact)) |
433 |
(1+ shifted-epact) |
(paschal-moon ;; Day after the full moon on or after March 21. |
434 |
shifted-epact)) |
(- (calendar-absolute-from-gregorian (list 4 19 displayed-year)) |
435 |
(paschal-moon ;; Day after the full moon on or after March 21. |
adjusted-epact)) |
436 |
(- (calendar-absolute-from-gregorian (list 4 19 displayed-year)) |
(abs-easter (calendar-dayname-on-or-before 0 (+ paschal-moon 7))) |
437 |
adjusted-epact)) |
(mandatory |
|
(abs-easter (calendar-dayname-on-or-before 0 (+ paschal-moon 7))) |
|
|
(mandatory |
|
438 |
(list |
(list |
439 |
(list (calendar-gregorian-from-absolute abs-easter) |
(list (calendar-gregorian-from-absolute (+ abs-easter n)) |
440 |
"Easter Sunday") |
string))) |
441 |
(list (calendar-gregorian-from-absolute (- abs-easter 2)) |
(output-list (filter-visible-calendar-holidays mandatory))) |
442 |
"Good Friday") |
output-list)) |
|
(list (calendar-gregorian-from-absolute (- abs-easter 46)) |
|
|
"Ash Wednesday"))) |
|
|
(optional |
|
|
(list |
|
|
(list (calendar-gregorian-from-absolute (- abs-easter 63)) |
|
|
"Septuagesima Sunday") |
|
|
(list (calendar-gregorian-from-absolute (- abs-easter 56)) |
|
|
"Sexagesima Sunday") |
|
|
(list (calendar-gregorian-from-absolute (- abs-easter 49)) |
|
|
"Shrove Sunday") |
|
|
(list (calendar-gregorian-from-absolute (- abs-easter 48)) |
|
|
"Shrove Monday") |
|
|
(list (calendar-gregorian-from-absolute (- abs-easter 47)) |
|
|
"Shrove Tuesday") |
|
|
(list (calendar-gregorian-from-absolute (- abs-easter 14)) |
|
|
"Passion Sunday") |
|
|
(list (calendar-gregorian-from-absolute (- abs-easter 7)) |
|
|
"Palm Sunday") |
|
|
(list (calendar-gregorian-from-absolute (- abs-easter 3)) |
|
|
"Maundy Thursday") |
|
|
(list (calendar-gregorian-from-absolute (+ abs-easter 35)) |
|
|
"Rogation Sunday") |
|
|
(list (calendar-gregorian-from-absolute (+ abs-easter 39)) |
|
|
"Ascension Day") |
|
|
(list (calendar-gregorian-from-absolute (+ abs-easter 49)) |
|
|
"Pentecost (Whitsunday)") |
|
|
(list (calendar-gregorian-from-absolute (+ abs-easter 50)) |
|
|
"Whitmonday") |
|
|
(list (calendar-gregorian-from-absolute (+ abs-easter 56)) |
|
|
"Trinity Sunday") |
|
|
(list (calendar-gregorian-from-absolute (+ abs-easter 60)) |
|
|
"Corpus Christi"))) |
|
|
(output-list |
|
|
(filter-visible-calendar-holidays mandatory))) |
|
|
(if all-christian-calendar-holidays |
|
|
(setq output-list |
|
|
(append |
|
|
(filter-visible-calendar-holidays optional) |
|
|
output-list))) |
|
|
output-list))) |
|
443 |
|
|
444 |
(defun holiday-greek-orthodox-easter () |
(defun holiday-greek-orthodox-easter () |
445 |
"Date of Easter according to the rule of the Council of Nicaea." |
"Date of Easter according to the rule of the Council of Nicaea." |