summaryrefslogtreecommitdiff
path: root/lisp/calendar
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2004-12-07 00:58:02 +0000
committerGlenn Morris <rgm@gnu.org>2004-12-07 00:58:02 +0000
commit92dd6c93c014de935497de3124b43c83489d9057 (patch)
treeb5498d6614d25755239d23eef5ac4507a2816cc9 /lisp/calendar
parent94f1c41a48dad5de7e963cc075c08816efbf1597 (diff)
downloademacs-92dd6c93c014de935497de3124b43c83489d9057.tar.gz
(holiday-advent): Make arguments optional for backwards
compatability. Doc fix.
Diffstat (limited to 'lisp/calendar')
-rw-r--r--lisp/calendar/holidays.el36
1 files changed, 23 insertions, 13 deletions
diff --git a/lisp/calendar/holidays.el b/lisp/calendar/holidays.el
index 86dad183238..48c7d0b8dce 100644
--- a/lisp/calendar/holidays.el
+++ b/lisp/calendar/holidays.el
@@ -400,19 +400,29 @@ date. If date is nil, or if the date is not visible, there is no holiday."
(string (if date (eval string))))
(list (list date string)))))))
-(defun holiday-advent (n string)
- "Date of Nth day after advent (named STRING), if visible in calendar window."
- (let ((year displayed-year)
- (month displayed-month))
- (increment-calendar-month month year -1)
- (let ((advent (calendar-gregorian-from-absolute
- (+ n
- (calendar-dayname-on-or-before
- 0
- (calendar-absolute-from-gregorian
- (list 12 3 year)))))))
- (if (calendar-date-is-visible-p advent)
- (list (list advent string))))))
+(defun holiday-advent (&optional n string)
+ "Date of Nth day after advent (named STRING), if visible in calendar window.
+Negative values of N are interpreted as days before advent.
+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 advent.
+
+For backwards compatability, if this function is called with no
+arguments, then it returns the value appropriate for advent itself."
+ ;; Backwards compatability layer.
+ (if (not n)
+ (holiday-advent 0 "Advent")
+ (let ((year displayed-year)
+ (month displayed-month))
+ (increment-calendar-month month year -1)
+ (let ((advent (calendar-gregorian-from-absolute
+ (+ n
+ (calendar-dayname-on-or-before
+ 0
+ (calendar-absolute-from-gregorian
+ (list 12 3 year)))))))
+ (if (calendar-date-is-visible-p advent)
+ (list (list advent string)))))))
(defun holiday-easter-etc (&optional n string)
"Date of Nth day after Easter (named STRING), if visible in calendar window.