summaryrefslogtreecommitdiff
path: root/lisp/calendar/cal-china.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2008-03-31 07:40:11 +0000
committerGlenn Morris <rgm@gnu.org>2008-03-31 07:40:11 +0000
commit0d16be53d138979c88d56bf0812a7c6c237d0491 (patch)
tree7f41c652dff552b759b9bc3f59a5e0d1deff9ca0 /lisp/calendar/cal-china.el
parenta0e0846723c8b0b75688fcb309f80dd640afa1b8 (diff)
downloademacs-0d16be53d138979c88d56bf0812a7c6c237d0491.tar.gz
(holiday-chinese-new-year): Doc fix and comment.
Diffstat (limited to 'lisp/calendar/cal-china.el')
-rw-r--r--lisp/calendar/cal-china.el18
1 files changed, 12 insertions, 6 deletions
diff --git a/lisp/calendar/cal-china.el b/lisp/calendar/cal-china.el
index 544a09b2614..702fec9931a 100644
--- a/lisp/calendar/cal-china.el
+++ b/lisp/calendar/cal-china.el
@@ -421,19 +421,25 @@ Gregorian date Sunday, December 31, 1 BC."
;;;###holiday-autoload
(defun holiday-chinese-new-year ()
- "Date of Chinese New Year."
+ "Date of Chinese New Year, if visible in calendar.
+Returns (((MONTH DAY YEAR) TEXT)), where the date is Gregorian."
(let ((m displayed-month)
(y displayed-year))
- (increment-calendar-month m y 1)
+ ;; In the Gregorian calendar, CNY falls between Jan 21 and Feb 20.
+ ;; Jan is visible if displayed-month = 12, 1, 2; Feb if d-m = 1, 2, 3.
+ ;; If we shift the calendar forward one month, we can do a
+ ;; one-sided test, namely: d-m <= 4 means CNYN might be visible.
+ (increment-calendar-month m y 1) ; shift forward a month
(if (< m 5)
(let ((chinese-new-year
(calendar-gregorian-from-absolute
(cadr (assoc 1 (chinese-year y))))))
(if (calendar-date-is-visible-p chinese-new-year)
- (list
- (list chinese-new-year
- (format "Chinese New Year (%s)"
- (calendar-chinese-sexagesimal-name (+ y 57))))))))))
+ (list
+ (list chinese-new-year
+ (format "Chinese New Year (%s)"
+ (calendar-chinese-sexagesimal-name
+ (+ y 57))))))))))
;;;###cal-autoload
(defun calendar-chinese-date-string (&optional date)