all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ed Reingold <reingold@emr.cs.iit.edu>
Cc: emacs-devel@gnu.org
Subject: Re: holidays.el
Date: Mon, 19 Jul 2004 12:35:01 -0500	[thread overview]
Message-ID: <200407191735.i6JHZ19B015634@emr.cs.iit.edu> (raw)
In-Reply-To: <"Message from hmalmedal"@yahoo.no> "of Mon, 19 Jul 2004 17:59:18 +0200." <cdgr4o$u95$1@sea.gmane.org>

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
> Emacs-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2004-07-19 17:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <"Message from hmalmedal"@yahoo.no>
2004-07-19 15:59 ` holidays.el Håkon Malmedal
2004-07-19 17:35   ` Ed Reingold [this message]
2004-09-22 23:27   ` holidays.el Glenn Morris
2004-09-23  7:26     ` holidays.el Kim F. Storm
2004-09-23 10:05       ` holidays.el Glenn Morris
2004-09-23 10:28         ` holidays.el Kim F. Storm
2004-09-23 16:08           ` holidays.el Glenn Morris
2004-09-23 16:44           ` holidays.el Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200407191735.i6JHZ19B015634@emr.cs.iit.edu \
    --to=reingold@emr.cs.iit.edu \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.