all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Foivos S. Zakkak <foivos@zakkak.net>
To: emacs-devel@gnu.org
Subject: [RFC] Extend holiday-greek-orthodox-easter in calendar
Date: Thu, 13 Aug 2015 16:36:56 +0300	[thread overview]
Message-ID: <yx80fv3nz4w7.fsf@zakkak.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 2662 bytes --]


* 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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 212 bytes --]

             reply	other threads:[~2015-08-13 13:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-13 13:36 Foivos S. Zakkak [this message]
2015-08-13 18:01 ` bug#21256: [RFC] Extend holiday-greek-orthodox-easter in calendar Paul Eggert
2015-08-13 18:05 ` Paul Eggert
2015-08-13 18:38   ` Foivos S. Zakkak
2015-08-13 19:19     ` Paul Eggert
2015-08-13 19:49       ` Foivos S. Zakkak
  -- strict thread matches above, loose matches on Subject: below --
2015-07-05 21:42 Foivos S. Zakkak

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=yx80fv3nz4w7.fsf@zakkak.net \
    --to=foivos@zakkak.net \
    --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.