unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: 21256@debbugs.gnu.org
Cc: "Foivos S. Zakkak" <foivos@zakkak.net>
Subject: bug#21256: [RFC] Extend holiday-greek-orthodox-easter in calendar
Date: Thu, 13 Aug 2015 11:01:46 -0700	[thread overview]
Message-ID: <55CCDB8A.2080006@cs.ucla.edu> (raw)
In-Reply-To: <yx80fv3nz4w7.fsf@zakkak.net>

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

Tags: patch
Severity: wishlist

Forwarded from:
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00519.html

-------- Forwarded Message --------
Subject: [RFC] Extend holiday-greek-orthodox-easter in calendar
Date: Thu, 13 Aug 2015 16:36:56 +0300
From: Foivos S. Zakkak <foivos@zakkak.net>
To: emacs-devel@gnu.org


* 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: 213 bytes --]

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

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <yx80fv3nz4w7.fsf@zakkak.net>
2015-08-13 18:01 ` Paul Eggert [this message]
2015-08-13 18:05 ` bug#21256: [RFC] Extend holiday-greek-orthodox-easter in calendar 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

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=55CCDB8A.2080006@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=21256@debbugs.gnu.org \
    --cc=foivos@zakkak.net \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).