[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: holidays.el
From: |
Ed Reingold |
Subject: |
Re: holidays.el |
Date: |
Mon, 19 Jul 2004 12:35:01 -0500 |
That's a good idea--there are similar things elsewhere that should be changed.
I did not write it that way originally (nearly 20 years ago!) because it would
have been too slow; now hardware is so fast that the difference in time would
be negligible. Feel free to fix this.
> I was thinking that if the function holiday-easter-etc looked
> something like this:
>
> (defun holiday-easter-etc (n string)
> "Holiday on Nth day after Easter called STRING."
> (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))
> (abs-easter (calendar-dayname-on-or-before 0 (+ paschal-moon 7)))
> (mandatory
> (list
> (list (calendar-gregorian-from-absolute (+ abs-easter n))
> string)))
> (output-list
> (filter-visible-calendar-holidays mandatory)))
> output-list))
>
> and the function holiday-advent looked something like this:
>
> (defun holiday-advent (n string)
> "Holiday on Nth day after Advent called STRING."
> (let ((year displayed-year)
> (month displayed-month))
> (increment-calendar-month month year -1)
> (let ((advent (calendar-gregorian-from-absolute
> (+ n
> (calendar-dayname-on-or-before 0
> (calendar-absolute-from-gregorian
> (list 12 3 year)))))))
> (if (calendar-date-is-visible-p advent)
> (list (list advent string))))))
>
> then the variable christian-holidays (in calendar.el) could look like
> this:
>
> ;;;###autoload
> (put 'christian-holidays 'risky-local-variable t)
> ;;;###autoload
> (defcustom christian-holidays
> '((if all-christian-calendar-holidays
> (holiday-fixed 1 6 "Epiphany"))
> (holiday-easter-etc 0 "Easter Sunday")
> (holiday-easter-etc -2 "Good Friday")
> (holiday-easter-etc -46 "Ash Wednesday")
> (if all-christian-calendar-holidays
> (holiday-easter-etc -63 "Septuagesima Sunday"))
> (if all-christian-calendar-holidays
> (holiday-easter-etc -56 "Sexagesima Sunday"))
> (if all-christian-calendar-holidays
> (holiday-easter-etc -49 "Shrove Sunday"))
> (if all-christian-calendar-holidays
> (holiday-easter-etc -48 "Shrove Monday"))
> (if all-christian-calendar-holidays
> (holiday-easter-etc -47 "Shrove Tuesday"))
> (if all-christian-calendar-holidays
> (holiday-easter-etc -14 "Passion Sunday"))
> (if all-christian-calendar-holidays
> (holiday-easter-etc -7 "Palm Sunday"))
> (if all-christian-calendar-holidays
> (holiday-easter-etc -3 "Maundy Thursday"))
> (if all-christian-calendar-holidays
> (holiday-easter-etc 35 "Rogation Sunday"))
> (if all-christian-calendar-holidays
> (holiday-easter-etc 39 "Ascension Day"))
> (if all-christian-calendar-holidays
> (holiday-easter-etc 49 "Pentecost (Whitsunday)"))
> (if all-christian-calendar-holidays
> (holiday-easter-etc 50 "Whitmonday"))
> (if all-christian-calendar-holidays
> (holiday-easter-etc 56 "Trinity Sunday"))
> (if all-christian-calendar-holidays
> (holiday-easter-etc 60 "Corpus Christi"))
> (if all-christian-calendar-holidays
> (holiday-greek-orthodox-easter))
> (if all-christian-calendar-holidays
> (holiday-fixed 8 15 "Assumption"))
> (if all-christian-calendar-holidays
> (holiday-advent 0 "Advent"))
> (holiday-fixed 12 25 "Christmas")
> (if all-christian-calendar-holidays
> (holiday-julian 12 25 "Eastern Orthodox Christmas")))
> "*Christian holidays.
> See the documentation for `calendar-holidays' for details."
> :type 'sexp
> :group 'holidays)
>
> and be much easier to customize. Is this a good/bad idea?
>
>
>
> _______________________________________________
> Emacs-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-devel
- holidays.el, HÃ¥kon Malmedal, 2004/07/19
- Re: holidays.el,
Ed Reingold <=