emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC] Extend holiday-greek-orthodox-easter in calendar


From: Foivos S . Zakkak
Subject: [RFC] Extend holiday-greek-orthodox-easter in calendar
Date: Thu, 13 Aug 2015 16:36:56 +0300

* Description

Extend holiday-greek-orthodox-easter to work like holiday-easter-etc.
That is, accept two optional arguments (n string) and calculate the Date
of Nth day after Easter (named STRING), if visible in calendar window.
The date is calculated according to the rule of the Council of Nicaea.

For backwards compatibility, if this function is called with no
arguments, then it returns the Pascha (Greek Orthodox Easter) day.

* The patch

--8<---------------cut here---------------start------------->8---
--- holidays_orig.el    2015-07-06 00:27:54.992714111 +0300
+++ holidays.el 2015-07-06 00:37:19.530996341 +0300
@@ -791,8 +791,20 @@
 ;; Prior call to calendar-julian-from-absolute will autoload cal-julian.
 (declare-function calendar-julian-to-absolute "cal-julian" (date))

-(defun holiday-greek-orthodox-easter ()
-  "Date of Easter according to the rule of the Council of Nicaea."
+(defun holiday-greek-orthodox-easter (&optional n string)
+  "Date of Nth day after Easter (named STRING), if visible in calendar
+window.  The date is calculated according to the rule of the Council of
+Nicaea.  Negative values of N are interpreted as days before Easter.
+STRING is used purely for display purposes.  The return value has the
+form ((MONTH DAY YEAR) STRING), where the date is that of the Nth day
+before or after Easter.
+
+For backwards compatibility, if this function is called with no
+arguments, then it returns the Pascha (Greek Orthodox Easter)
+day."
+  ;; Backwards compatibility layer.
+  (if (not n)
+      (holiday-greek-orthodox-easter 0 "Pascha (Greek Orthodox Easter)")
   (let* ((m displayed-month)
          (y displayed-year)
          (julian-year (progn
@@ -808,11 +820,11 @@
          (paschal-moon      ; day after full moon on or after March 21
           (- (calendar-julian-to-absolute (list 4 19 julian-year))
              shifted-epact))
-         (nicaean-easter           ; Sunday following the Paschal moon
-          (calendar-gregorian-from-absolute
-           (calendar-dayname-on-or-before 0 (+ paschal-moon 7)))))
-    (if (calendar-date-is-visible-p nicaean-easter)
-        (list (list nicaean-easter "Pascha (Greek Orthodox Easter)")))))
+         ;; Sunday following the Paschal moon
+         (abs-easter (calendar-dayname-on-or-before 0 (+ paschal-moon 7)))
+         (greg (calendar-gregorian-from-absolute (+ abs-easter n))))
+    (if (calendar-date-is-visible-p greg)
+          (list (list greg string))))))

 (provide 'holidays)

--8<---------------cut here---------------end--------------->8---

Kind regards,
Foivos
--
WWW: foivos.zakkak.net
PGP: 7B40 69D9 29BA AE91 C0B3  220A 0846 BFD1 03F0 4EA1

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]