aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/calendar/cal-china.el21
1 files changed, 10 insertions, 11 deletions
diff --git a/lisp/calendar/cal-china.el b/lisp/calendar/cal-china.el
index 51ba42b9a8b..eb07e41477d 100644
--- a/lisp/calendar/cal-china.el
+++ b/lisp/calendar/cal-china.el
@@ -422,22 +422,21 @@ Gregorian date Sunday, December 31, 1 BC."
422 "Date of Chinese New Year, if visible in calendar. 422 "Date of Chinese New Year, if visible in calendar.
423Returns (((MONTH DAY YEAR) TEXT)), where the date is Gregorian." 423Returns (((MONTH DAY YEAR) TEXT)), where the date is Gregorian."
424 (let ((m displayed-month) 424 (let ((m displayed-month)
425 (y displayed-year)) 425 (y displayed-year)
426 chinese-new-year)
426 ;; In the Gregorian calendar, CNY falls between Jan 21 and Feb 20. 427 ;; In the Gregorian calendar, CNY falls between Jan 21 and Feb 20.
427 ;; Jan is visible if displayed-month = 12, 1, 2; Feb if d-m = 1, 2, 3. 428 ;; Jan is visible if displayed-month = 12, 1, 2; Feb if d-m = 1, 2, 3.
428 ;; If we shift the calendar forward one month, we can do a 429 ;; If we shift the calendar forward one month, we can do a
429 ;; one-sided test, namely: d-m <= 4 means CNY might be visible. 430 ;; one-sided test, namely: d-m <= 4 means CNY might be visible.
430 (increment-calendar-month m y 1) ; shift forward a month 431 (increment-calendar-month m y 1) ; shift forward a month
431 (if (< m 5) 432 (and (< m 5)
432 (let ((chinese-new-year 433 (calendar-date-is-visible-p (setq chinese-new-year
433 (calendar-gregorian-from-absolute 434 (calendar-gregorian-from-absolute
434 (cadr (assoc 1 (chinese-year y)))))) 435 (cadr (assoc 1 (chinese-year y))))))
435 (if (calendar-date-is-visible-p chinese-new-year) 436 (list
436 (list 437 (list chinese-new-year
437 (list chinese-new-year 438 (format "Chinese New Year (%s)"
438 (format "Chinese New Year (%s)" 439 (calendar-chinese-sexagesimal-name (+ y 57))))))))
439 (calendar-chinese-sexagesimal-name
440 (+ y 57))))))))))
441 440
442;;;###cal-autoload 441;;;###cal-autoload
443(defun calendar-chinese-date-string (&optional date) 442(defun calendar-chinese-date-string (&optional date)