diff options
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/calendar/cal-china.el | 70 |
2 files changed, 43 insertions, 35 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 17c9c7de00d..25a81dd4b4e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -23,6 +23,14 @@ | |||
| 23 | calendar.el. | 23 | calendar.el. |
| 24 | (chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch): | 24 | (chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch): |
| 25 | Make constants. | 25 | Make constants. |
| 26 | * calendar/cal-china.el (chinese-calendar-time-zone) | ||
| 27 | (chinese-calendar-daylight-time-offset) | ||
| 28 | (chinese-calendar-daylight-savings-starts) | ||
| 29 | (chinese-calendar-daylight-savings-ends) | ||
| 30 | (chinese-calendar-daylight-savings-starts-time) | ||
| 31 | (chinese-calendar-daylight-savings-ends-time) | ||
| 32 | (chinese-zodiac-sign-on-or-after, chinese-new-moon-on-or-after): | ||
| 33 | Doc fixes. | ||
| 26 | 34 | ||
| 27 | * calendar/cal-coptic.el (coptic-name): Add doc string. | 35 | * calendar/cal-coptic.el (coptic-name): Add doc string. |
| 28 | 36 | ||
diff --git a/lisp/calendar/cal-china.el b/lisp/calendar/cal-china.el index f11a692b108..416f5ff9641 100644 --- a/lisp/calendar/cal-china.el +++ b/lisp/calendar/cal-china.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; cal-china.el --- calendar functions for the Chinese calendar | 1 | ;;; cal-china.el --- calendar functions for the Chinese calendar |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1995, 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 | 3 | ;; Copyright (C) 1995, 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007, |
| 4 | ;; Free Software Foundation, Inc. | 4 | ;; 2008 Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu> | 6 | ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu> |
| 7 | ;; Maintainer: Glenn Morris <rgm@gnu.org> | 7 | ;; Maintainer: Glenn Morris <rgm@gnu.org> |
| @@ -71,9 +71,9 @@ UT+7:45:40 to UT+8." | |||
| 71 | :group 'chinese-calendar) | 71 | :group 'chinese-calendar) |
| 72 | 72 | ||
| 73 | (defcustom chinese-calendar-daylight-time-offset 0 | 73 | (defcustom chinese-calendar-daylight-time-offset 0 |
| 74 | ; The correct value is as follows, but the Chinese calendrical | 74 | ;; The correct value is as follows, but the Chinese calendrical |
| 75 | ; authorities do NOT use DST in determining astronomical events: | 75 | ;; authorities do NOT use DST in determining astronomical events: |
| 76 | ; 60 | 76 | ;; 60 |
| 77 | "Number of minutes difference between daylight saving and standard time | 77 | "Number of minutes difference between daylight saving and standard time |
| 78 | for Chinese calendar. Default is for no daylight saving time." | 78 | for Chinese calendar. Default is for no daylight saving time." |
| 79 | :type 'integer | 79 | :type 'integer |
| @@ -95,11 +95,11 @@ at 1928-01-01 00:00:00 from `PMT' to `CST'." | |||
| 95 | :group 'chinese-calendar) | 95 | :group 'chinese-calendar) |
| 96 | 96 | ||
| 97 | (defcustom chinese-calendar-daylight-savings-starts nil | 97 | (defcustom chinese-calendar-daylight-savings-starts nil |
| 98 | ; The correct value is as follows, but the Chinese calendrical | 98 | ;; The correct value is as follows, but the Chinese calendrical |
| 99 | ; authorities do NOT use DST in determining astronomical events: | 99 | ;; authorities do NOT use DST in determining astronomical events: |
| 100 | ; '(cond ((< 1986 year) (calendar-nth-named-day 1 0 4 year 10)) | 100 | ;; '(cond ((< 1986 year) (calendar-nth-named-day 1 0 4 year 10)) |
| 101 | ; ((= 1986 year) '(5 4 1986)) | 101 | ;; ((= 1986 year) '(5 4 1986)) |
| 102 | ; (t nil)) | 102 | ;; (t nil)) |
| 103 | "Sexp giving the date on which daylight saving time starts for Chinese | 103 | "Sexp giving the date on which daylight saving time starts for Chinese |
| 104 | calendar. Default is for no daylight saving time. See documentation of | 104 | calendar. Default is for no daylight saving time. See documentation of |
| 105 | `calendar-daylight-savings-starts'." | 105 | `calendar-daylight-savings-starts'." |
| @@ -107,9 +107,9 @@ calendar. Default is for no daylight saving time. See documentation of | |||
| 107 | :group 'chinese-calendar) | 107 | :group 'chinese-calendar) |
| 108 | 108 | ||
| 109 | (defcustom chinese-calendar-daylight-savings-ends nil | 109 | (defcustom chinese-calendar-daylight-savings-ends nil |
| 110 | ; The correct value is as follows, but the Chinese calendrical | 110 | ;; The correct value is as follows, but the Chinese calendrical |
| 111 | ; authorities do NOT use DST in determining astronomical events: | 111 | ;; authorities do NOT use DST in determining astronomical events: |
| 112 | ; '(if (<= 1986 year) (calendar-nth-named-day 1 0 9 year 11)) | 112 | ;; '(if (<= 1986 year) (calendar-nth-named-day 1 0 9 year 11)) |
| 113 | "Sexp giving the date on which daylight saving time ends for Chinese | 113 | "Sexp giving the date on which daylight saving time ends for Chinese |
| 114 | calendar. Default is for no daylight saving time. See documentation of | 114 | calendar. Default is for no daylight saving time. See documentation of |
| 115 | `calendar-daylight-savings-ends'." | 115 | `calendar-daylight-savings-ends'." |
| @@ -267,20 +267,20 @@ numbers used for leap months. | |||
| 267 | First month of list will never be a leap month, nor will the last." | 267 | First month of list will never be a leap month, nor will the last." |
| 268 | (if list | 268 | (if list |
| 269 | (if (zerop (- 12 start (length list))) | 269 | (if (zerop (- 12 start (length list))) |
| 270 | ;; List is too short for a leap month | 270 | ;; List is too short for a leap month. |
| 271 | (cons (list start (car list)) | 271 | (cons (list start (car list)) |
| 272 | (number-chinese-months (cdr list) (1+ start))) | 272 | (number-chinese-months (cdr list) (1+ start))) |
| 273 | (cons | 273 | (cons |
| 274 | ;; First month | 274 | ;; First month. |
| 275 | (list start (car list)) | 275 | (list start (car list)) |
| 276 | ;; Remaining months | 276 | ;; Remaining months. |
| 277 | (if (and (cdr (cdr list));; at least two more months... | 277 | (if (and (cdr (cdr list)) ; at least two more months... |
| 278 | (<= (car (cdr (cdr list))) | 278 | (<= (car (cdr (cdr list))) |
| 279 | (chinese-zodiac-sign-on-or-after (car (cdr list))))) | 279 | (chinese-zodiac-sign-on-or-after (car (cdr list))))) |
| 280 | ;; Next month is a leap month | 280 | ;; Next month is a leap month. |
| 281 | (cons (list (+ start 0.5) (car (cdr list))) | 281 | (cons (list (+ start 0.5) (car (cdr list))) |
| 282 | (number-chinese-months (cdr (cdr list)) (1+ start))) | 282 | (number-chinese-months (cdr (cdr list)) (1+ start))) |
| 283 | ;; Next month is not a leap month | 283 | ;; Next month is not a leap month. |
| 284 | (number-chinese-months (cdr list) (1+ start))))))) | 284 | (number-chinese-months (cdr list) (1+ start))))))) |
| 285 | 285 | ||
| 286 | (defun chinese-month-list (start end) | 286 | (defun chinese-month-list (start end) |
| @@ -305,24 +305,24 @@ Gregorian year Y-1 to the Chinese month of the solstice of Gregorian year Y." | |||
| 305 | next-solstice)) | 305 | next-solstice)) |
| 306 | (next-sign (chinese-zodiac-sign-on-or-after (car list)))) | 306 | (next-sign (chinese-zodiac-sign-on-or-after (car list)))) |
| 307 | (if (= (length list) 12) | 307 | (if (= (length list) 12) |
| 308 | ;; No room for a leap month, just number them 12, 1, 2, ..., 11 | 308 | ;; No room for a leap month, just number them 12, 1, 2, ..., 11. |
| 309 | (cons (list 12 (car list)) | 309 | (cons (list 12 (car list)) |
| 310 | (number-chinese-months (cdr list) 1)) | 310 | (number-chinese-months (cdr list) 1)) |
| 311 | ;; Now we can assign numbers to the list for y | 311 | ;; Now we can assign numbers to the list for y. |
| 312 | ;; The first month or two are special | 312 | ;; The first month or two are special. |
| 313 | (if (or (> (car list) next-sign) (>= next-sign (car (cdr list)))) | 313 | (if (or (> (car list) next-sign) (>= next-sign (car (cdr list)))) |
| 314 | ;; First month on list is a leap month, second is not | 314 | ;; First month on list is a leap month, second is not. |
| 315 | (append (list (list 11.5 (car list)) | 315 | (append (list (list 11.5 (car list)) |
| 316 | (list 12 (car (cdr list)))) | 316 | (list 12 (car (cdr list)))) |
| 317 | (number-chinese-months (cdr (cdr list)) 1)) | 317 | (number-chinese-months (cdr (cdr list)) 1)) |
| 318 | ;; First month on list is not a leap month | 318 | ;; First month on list is not a leap month. |
| 319 | (append (list (list 12 (car list))) | 319 | (append (list (list 12 (car list))) |
| 320 | (if (>= (chinese-zodiac-sign-on-or-after (car (cdr list))) | 320 | (if (>= (chinese-zodiac-sign-on-or-after (car (cdr list))) |
| 321 | (car (cdr (cdr list)))) | 321 | (car (cdr (cdr list)))) |
| 322 | ;; Second month on list is a leap month | 322 | ;; Second month on list is a leap month. |
| 323 | (cons (list 12.5 (car (cdr list))) | 323 | (cons (list 12.5 (car (cdr list))) |
| 324 | (number-chinese-months (cdr (cdr list)) 1)) | 324 | (number-chinese-months (cdr (cdr list)) 1)) |
| 325 | ;; Second month on list is not a leap month | 325 | ;; Second month on list is not a leap month. |
| 326 | (number-chinese-months (cdr list) 1))))))) | 326 | (number-chinese-months (cdr list) 1))))))) |
| 327 | 327 | ||
| 328 | (defun calendar-absolute-from-chinese (date) | 328 | (defun calendar-absolute-from-chinese (date) |
| @@ -332,12 +332,12 @@ The Gregorian date Sunday, December 31, 1 BC is imaginary." | |||
| 332 | (year (car (cdr date))) | 332 | (year (car (cdr date))) |
| 333 | (month (car (cdr (cdr date)))) | 333 | (month (car (cdr (cdr date)))) |
| 334 | (day (car (cdr (cdr (cdr date))))) | 334 | (day (car (cdr (cdr (cdr date))))) |
| 335 | (g-year (+ (* (1- cycle) 60);; years in prior cycles | 335 | (g-year (+ (* (1- cycle) 60) ; years in prior cycles |
| 336 | (1- year) ;; prior years this cycle | 336 | (1- year) ; prior years this cycle |
| 337 | -2636))) ;; years before absolute date 0 | 337 | -2636))) ; years before absolute date 0 |
| 338 | (+ (1- day);; prior days this month | 338 | (+ (1- day) ; prior days this month |
| 339 | (car | 339 | (car |
| 340 | (cdr ;; absolute date of start of this month | 340 | (cdr ; absolute date of start of this month |
| 341 | (assoc month (append (memq (assoc 1 (chinese-year g-year)) | 341 | (assoc month (append (memq (assoc 1 (chinese-year g-year)) |
| 342 | (chinese-year g-year)) | 342 | (chinese-year g-year)) |
| 343 | (chinese-year (1+ g-year))))))))) | 343 | (chinese-year (1+ g-year))))))))) |
| @@ -353,12 +353,12 @@ Gregorian date Sunday, December 31, 1 BC." | |||
| 353 | (chinese-year g-year) | 353 | (chinese-year g-year) |
| 354 | (chinese-year (1+ g-year))))) | 354 | (chinese-year (1+ g-year))))) |
| 355 | (while (<= (car (cdr (car (cdr list)))) date) | 355 | (while (<= (car (cdr (car (cdr list)))) date) |
| 356 | ;; the first month on the list is in Chinese year c-year | 356 | ;; The first month on the list is in Chinese year c-year. |
| 357 | ;; date is on or after start of second month on list... | 357 | ;; Date is on or after start of second month on list... |
| 358 | (if (= 1 (car (car (cdr list)))) | 358 | (if (= 1 (car (car (cdr list)))) |
| 359 | ;; second month on list is a new Chinese year | 359 | ;; Second month on list is a new Chinese year... |
| 360 | (setq c-year (1+ c-year))) | 360 | (setq c-year (1+ c-year))) |
| 361 | ;; ...so first month on list is of no interest | 361 | ;; ...so first month on list is of no interest. |
| 362 | (setq list (cdr list))) | 362 | (setq list (cdr list))) |
| 363 | (list (/ (1- c-year) 60) | 363 | (list (/ (1- c-year) 60) |
| 364 | (calendar-mod c-year 60) | 364 | (calendar-mod c-year 60) |