summaryrefslogtreecommitdiff
path: root/lisp/calendar/holidays.el
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2015-08-13 12:16:25 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2015-08-13 12:17:50 -0700
commitb532875a6021cd1715321dda932b187522840944 (patch)
tree33b6c2d8b43dc68efe2463325262d55fca9ea988 /lisp/calendar/holidays.el
parent57adf425f511b90153f128e7679b5f432df13fb5 (diff)
downloademacs-b532875a6021cd1715321dda932b187522840944.tar.gz
Optional args for holiday-greek-orthodox-easter
* 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).
Diffstat (limited to 'lisp/calendar/holidays.el')
-rw-r--r--lisp/calendar/holidays.el21
1 files changed, 14 insertions, 7 deletions
diff --git a/lisp/calendar/holidays.el b/lisp/calendar/holidays.el
index 8085c1cf119..6d7cea6b8c5 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)