emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/calendar/cal-china.el,v


From: Glenn Morris
Subject: [Emacs-diffs] Changes to emacs/lisp/calendar/cal-china.el,v
Date: Mon, 31 Mar 2008 07:40:12 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Glenn Morris <gm>       08/03/31 07:40:11

Index: cal-china.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/calendar/cal-china.el,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- cal-china.el        26 Mar 2008 03:09:32 -0000      1.39
+++ cal-china.el        31 Mar 2008 07:40:11 -0000      1.40
@@ -421,10 +421,15 @@
 
 ;;;###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
@@ -433,7 +438,8 @@
           (list
            (list chinese-new-year
                  (format "Chinese New Year (%s)"
-                         (calendar-chinese-sexagesimal-name (+ y 57))))))))))
+                             (calendar-chinese-sexagesimal-name
+                              (+ y 57))))))))))
 
 ;;;###cal-autoload
 (defun calendar-chinese-date-string (&optional date)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]