all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: "Foivos S. Zakkak" <foivos@zakkak.net>
Cc: 21256-done@debbugs.gnu.org
Subject: bug#21256: [RFC] Extend holiday-greek-orthodox-easter in calendar
Date: Thu, 13 Aug 2015 12:19:52 -0700	[thread overview]
Message-ID: <55CCEDD8.9050205@cs.ucla.edu> (raw)
In-Reply-To: <yx80vbcj9gpe.fsf@zakkak.net>

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

Foivos S. Zakkak wrote:
> With this extension one can use the following configuration or similar:

Thanks for the explanation.  I installed the attached patch, which should have 
the same effect, and am marking this as done.  Please let me know if it has any 
problems.

[-- Attachment #2: 0001-Optional-args-for-holiday-greek-orthodox-easter.txt --]
[-- Type: text/plain, Size: 3047 bytes --]

From 226e6dcf5696575615ae9bf26486e32de43b5aa4 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 13 Aug 2015 12:16:25 -0700
Subject: [PATCH] Optional args for holiday-greek-orthodox-easter
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* etc/NEWS: Document this.
* lisp/calendar/holidays.el (holiday-greek-orthodox-easter):
Add optional args N and STRING, mimicking the API and code of
‘holiday-easter-etc’.  From suggestion by Foivos S. Zakkak (Bug#21256).
---
 etc/NEWS                  |  3 +++
 lisp/calendar/holidays.el | 21 ++++++++++++++-------
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 0a33a6e..3ec16f5 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -552,6 +552,9 @@ The option customizes which day headers receive the
 `calendar-weekend-header' face.
 
 ---
+*** New optional args N and STRING for ‘holiday-greek-orthodox-easter’.
+
+---
 *** Many items obsolete since at least version 23.1 have been removed.
 The majority were function/variable/face aliases, too numerous to list here.
 The remainder were:
diff --git a/lisp/calendar/holidays.el b/lisp/calendar/holidays.el
index 8085c1c..6d7cea6 100644
--- a/lisp/calendar/holidays.el
+++ b/lisp/calendar/holidays.el
@@ -791,8 +791,16 @@ is non-nil)."
 ;; 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.
+It 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, it returns the date of Pascha (Greek Orthodox Easter)."
   (let* ((m displayed-month)
          (y displayed-year)
          (julian-year (progn
@@ -808,11 +816,10 @@ is non-nil)."
          (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)")))))
+	 (abs-easter (calendar-dayname-on-or-before 0 (+ paschal-moon 7)))
+	 (greg (calendar-gregorian-from-absolute (+ abs-easter (or n 0)))))
+    (if (calendar-date-is-visible-p greg)
+	(list (list greg (or string "Pascha (Greek Orthodox Easter)"))))))
 
 (provide 'holidays)
 
-- 
2.1.4


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

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-13 13:36 [RFC] Extend holiday-greek-orthodox-easter in calendar Foivos S. Zakkak
2015-08-13 18:01 ` bug#21256: " Paul Eggert
2015-08-13 18:05 ` Paul Eggert
2015-08-13 18:38   ` Foivos S. Zakkak
2015-08-13 19:19     ` Paul Eggert [this message]
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

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

  git send-email \
    --in-reply-to=55CCEDD8.9050205@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=21256-done@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 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.