diff options
| author | Glenn Morris | 2004-12-07 00:46:08 +0000 |
|---|---|---|
| committer | Glenn Morris | 2004-12-07 00:46:08 +0000 |
| commit | 3cd74de74c368c0787e428890b5c360d5d2f9bd2 (patch) | |
| tree | bae5377dc847ee46584be70be07fa5ddf266aa91 | |
| parent | c9ba50dd017302f52686d821bc3113c4a86c803d (diff) | |
| download | emacs-3cd74de74c368c0787e428890b5c360d5d2f9bd2.tar.gz emacs-3cd74de74c368c0787e428890b5c360d5d2f9bd2.zip | |
(holiday-easter-etc): Make arguments optional for backwards
compatability. Doc fix. Remove un-necessary local vars mandatory,
output-list.
| -rw-r--r-- | lisp/calendar/holidays.el | 84 |
1 files changed, 58 insertions, 26 deletions
diff --git a/lisp/calendar/holidays.el b/lisp/calendar/holidays.el index a1adc080b2f..86dad183238 100644 --- a/lisp/calendar/holidays.el +++ b/lisp/calendar/holidays.el | |||
| @@ -414,32 +414,64 @@ date. If date is nil, or if the date is not visible, there is no holiday." | |||
| 414 | (if (calendar-date-is-visible-p advent) | 414 | (if (calendar-date-is-visible-p advent) |
| 415 | (list (list advent string)))))) | 415 | (list (list advent string)))))) |
| 416 | 416 | ||
| 417 | (defun holiday-easter-etc (n string) | 417 | (defun holiday-easter-etc (&optional n string) |
| 418 | "Date of Nth day after Easter (named STRING), if visible in calendar window." | 418 | "Date of Nth day after Easter (named STRING), if visible in calendar window. |
| 419 | (let* ((century (1+ (/ displayed-year 100))) | 419 | Negative values of N are interpreted as days before Easter. |
| 420 | (shifted-epact ;; Age of moon for April 5... | 420 | STRING is used purely for display purposes. The return value has |
| 421 | (% (+ 14 (* 11 (% displayed-year 19));; ...by Nicaean rule | 421 | the form ((MONTH DAY YEAR) STRING), where the date is that of the |
| 422 | (- ;; ...corrected for the Gregorian century rule | 422 | Nth day before or after Easter. |
| 423 | (/ (* 3 century) 4)) | 423 | |
| 424 | (/ ;; ...corrected for Metonic cycle inaccuracy. | 424 | For backwards compatability, if this function is called with no |
| 425 | (+ 5 (* 8 century)) 25) | 425 | arguments, then it returns a list of \"standard\" Easter-related |
| 426 | (* 30 century));; Keeps value positive. | 426 | holidays (with more entries if `all-christian-calendar-holidays' |
| 427 | 30)) | 427 | is non-nil)." |
| 428 | (adjusted-epact ;; Adjust for 29.5 day month. | 428 | ;; Backwards compatability layer. |
| 429 | (if (or (= shifted-epact 0) | 429 | (if (not n) |
| 430 | (and (= shifted-epact 1) (< 10 (% displayed-year 19)))) | 430 | (let (res-list res) |
| 431 | (1+ shifted-epact) | 431 | (dolist (elem (append |
| 432 | shifted-epact)) | 432 | (if all-christian-calendar-holidays |
| 433 | (paschal-moon ;; Day after the full moon on or after March 21. | 433 | '((-63 . "Septuagesima Sunday") |
| 434 | (- (calendar-absolute-from-gregorian (list 4 19 displayed-year)) | 434 | (-56 . "Sexagesima Sunday") |
| 435 | adjusted-epact)) | 435 | (-49 . "Shrove Sunday") |
| 436 | (abs-easter (calendar-dayname-on-or-before 0 (+ paschal-moon 7))) | 436 | (-48 . "Shrove Monday") |
| 437 | (mandatory | 437 | (-47 . "Shrove Tuesday") |
| 438 | (list | 438 | (-14 . "Passion Sunday") |
| 439 | (list (calendar-gregorian-from-absolute (+ abs-easter n)) | 439 | (-7 . "Palm Sunday") |
| 440 | string))) | 440 | (-3 . "Maundy Thursday") |
| 441 | (output-list (filter-visible-calendar-holidays mandatory))) | 441 | (35 . "Rogation Sunday") |
| 442 | output-list)) | 442 | (39 . "Ascension Day") |
| 443 | (49 . "Pentecost (Whitsunday)") | ||
| 444 | (50 . "Whitmonday") | ||
| 445 | (56 . "Trinity Sunday") | ||
| 446 | (60 . "Corpus Christi"))) | ||
| 447 | '((0 . "Easter Sunday") | ||
| 448 | (-2 . "Good Friday") | ||
| 449 | (-46 . "Ash Wednesday"))) | ||
| 450 | res-list) | ||
| 451 | ;; Filter out nil (not visible) values. | ||
| 452 | (if (setq res (holiday-easter-etc (car elem) (cdr elem))) | ||
| 453 | (setq res-list (append res res-list))))) | ||
| 454 | (let* ((century (1+ (/ displayed-year 100))) | ||
| 455 | (shifted-epact ;; Age of moon for April 5... | ||
| 456 | (% (+ 14 (* 11 (% displayed-year 19)) ;; ...by Nicaean rule | ||
| 457 | (- ;; ...corrected for the Gregorian century rule | ||
| 458 | (/ (* 3 century) 4)) | ||
| 459 | (/ ;; ...corrected for Metonic cycle inaccuracy. | ||
| 460 | (+ 5 (* 8 century)) 25) | ||
| 461 | (* 30 century)) ;; Keeps value positive. | ||
| 462 | 30)) | ||
| 463 | (adjusted-epact ;; Adjust for 29.5 day month. | ||
| 464 | (if (or (zerop shifted-epact) | ||
| 465 | (and (= shifted-epact 1) (< 10 (% displayed-year 19)))) | ||
| 466 | (1+ shifted-epact) | ||
| 467 | shifted-epact)) | ||
| 468 | (paschal-moon ;; Day after the full moon on or after March 21. | ||
| 469 | (- (calendar-absolute-from-gregorian (list 4 19 displayed-year)) | ||
| 470 | adjusted-epact)) | ||
| 471 | (abs-easter (calendar-dayname-on-or-before 0 (+ paschal-moon 7)))) | ||
| 472 | (filter-visible-calendar-holidays | ||
| 473 | (list (list (calendar-gregorian-from-absolute (+ abs-easter n)) | ||
| 474 | string)))))) | ||
| 443 | 475 | ||
| 444 | (defun holiday-greek-orthodox-easter () | 476 | (defun holiday-greek-orthodox-easter () |
| 445 | "Date of Easter according to the rule of the Council of Nicaea." | 477 | "Date of Easter according to the rule of the Council of Nicaea." |