diff options
| author | Glenn Morris | 2008-03-31 07:40:11 +0000 |
|---|---|---|
| committer | Glenn Morris | 2008-03-31 07:40:11 +0000 |
| commit | 0d16be53d138979c88d56bf0812a7c6c237d0491 (patch) | |
| tree | 7f41c652dff552b759b9bc3f59a5e0d1deff9ca0 | |
| parent | a0e0846723c8b0b75688fcb309f80dd640afa1b8 (diff) | |
| download | emacs-0d16be53d138979c88d56bf0812a7c6c237d0491.tar.gz emacs-0d16be53d138979c88d56bf0812a7c6c237d0491.zip | |
(holiday-chinese-new-year): Doc fix and comment.
| -rw-r--r-- | lisp/calendar/cal-china.el | 18 |
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." | |||
| 421 | 421 | ||
| 422 | ;;;###holiday-autoload | 422 | ;;;###holiday-autoload |
| 423 | (defun holiday-chinese-new-year () | 423 | (defun holiday-chinese-new-year () |
| 424 | "Date of Chinese New Year." | 424 | "Date of Chinese New Year, if visible in calendar. |
| 425 | Returns (((MONTH DAY YEAR) TEXT)), where the date is Gregorian." | ||
| 425 | (let ((m displayed-month) | 426 | (let ((m displayed-month) |
| 426 | (y displayed-year)) | 427 | (y displayed-year)) |
| 427 | (increment-calendar-month m y 1) | 428 | ;; In the Gregorian calendar, CNY falls between Jan 21 and Feb 20. |
| 429 | ;; Jan is visible if displayed-month = 12, 1, 2; Feb if d-m = 1, 2, 3. | ||
| 430 | ;; If we shift the calendar forward one month, we can do a | ||
| 431 | ;; one-sided test, namely: d-m <= 4 means CNYN might be visible. | ||
| 432 | (increment-calendar-month m y 1) ; shift forward a month | ||
| 428 | (if (< m 5) | 433 | (if (< m 5) |
| 429 | (let ((chinese-new-year | 434 | (let ((chinese-new-year |
| 430 | (calendar-gregorian-from-absolute | 435 | (calendar-gregorian-from-absolute |
| 431 | (cadr (assoc 1 (chinese-year y)))))) | 436 | (cadr (assoc 1 (chinese-year y)))))) |
| 432 | (if (calendar-date-is-visible-p chinese-new-year) | 437 | (if (calendar-date-is-visible-p chinese-new-year) |
| 433 | (list | 438 | (list |
| 434 | (list chinese-new-year | 439 | (list chinese-new-year |
| 435 | (format "Chinese New Year (%s)" | 440 | (format "Chinese New Year (%s)" |
| 436 | (calendar-chinese-sexagesimal-name (+ y 57)))))))))) | 441 | (calendar-chinese-sexagesimal-name |
| 442 | (+ y 57)))))))))) | ||
| 437 | 443 | ||
| 438 | ;;;###cal-autoload | 444 | ;;;###cal-autoload |
| 439 | (defun calendar-chinese-date-string (&optional date) | 445 | (defun calendar-chinese-date-string (&optional date) |