Mercurial > emacs
annotate lisp/calendar/cal-china.el @ 96849:d049ef97c446
* print.c (print_object): Check print_depth before searching for
circularities.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Mon, 21 Jul 2008 05:02:31 +0000 |
parents | e49abd957e81 |
children | a9dc0e7c3f2b |
rev | line source |
---|---|
38422
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
23143
diff
changeset
|
1 ;;; cal-china.el --- calendar functions for the Chinese calendar |
13053 | 2 |
92642 | 3 ;; Copyright (C) 1995, 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007, |
4 ;; 2008 Free Software Foundation, Inc. | |
13053 | 5 |
6 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu> | |
67465
a55ee709ec8d
Update copyright pending Emacs 22.
Glenn Morris <rgm@gnu.org>
parents:
65142
diff
changeset
|
7 ;; Maintainer: Glenn Morris <rgm@gnu.org> |
13053 | 8 ;; Keywords: calendar |
9 ;; Human-Keywords: Chinese calendar, calendar, holidays, diary | |
10 | |
11 ;; This file is part of GNU Emacs. | |
12 | |
94653
e49abd957e81
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94282
diff
changeset
|
13 ;; GNU Emacs is free software: you can redistribute it and/or modify |
13053 | 14 ;; it under the terms of the GNU General Public License as published by |
94653
e49abd957e81
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94282
diff
changeset
|
15 ;; the Free Software Foundation, either version 3 of the License, or |
e49abd957e81
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94282
diff
changeset
|
16 ;; (at your option) any later version. |
13053 | 17 |
18 ;; GNU Emacs is distributed in the hope that it will be useful, | |
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 ;; GNU General Public License for more details. | |
22 | |
23 ;; You should have received a copy of the GNU General Public License | |
94653
e49abd957e81
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94282
diff
changeset
|
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
13053 | 25 |
26 ;;; Commentary: | |
27 | |
93477
92c1edaba777
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93454
diff
changeset
|
28 ;; See calendar.el. |
13053 | 29 |
93477
92c1edaba777
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93454
diff
changeset
|
30 ;; The rules used for the Chinese calendar are those of Baolin Liu |
92c1edaba777
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93454
diff
changeset
|
31 ;; (see L. E. Doggett's article "Calendars" in the Explanatory |
92c1edaba777
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93454
diff
changeset
|
32 ;; Supplement to the Astronomical Almanac, second edition, 1992) for |
92c1edaba777
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93454
diff
changeset
|
33 ;; the calendar as revised at the beginning of the Qing dynasty in |
92c1edaba777
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93454
diff
changeset
|
34 ;; 1644. The nature of the astronomical calculations is such that |
92c1edaba777
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93454
diff
changeset
|
35 ;; precise calculations cannot be made without great expense in time, |
92c1edaba777
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93454
diff
changeset
|
36 ;; so that the calendars produced may not agree perfectly with |
92c1edaba777
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93454
diff
changeset
|
37 ;; published tables--but no two pairs of published tables agree |
92c1edaba777
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93454
diff
changeset
|
38 ;; perfectly either! Liu's rules produce a calendar for 2033 which is |
92c1edaba777
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93454
diff
changeset
|
39 ;; not accepted by all authorities. The date of Chinese New Year is |
92c1edaba777
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93454
diff
changeset
|
40 ;; correct from 1644-2051. |
20462
d179de7ad92e
Add reference to new Calendrical Calculations book.
Paul Eggert <eggert@twinsun.com>
parents:
20215
diff
changeset
|
41 |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
42 ;; Note to maintainers: |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
43 ;; Use `chinese-year-cache-init' every few years to recenter the default |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
44 ;; value of `chinese-year-cache'. |
13053 | 45 |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
46 ;;; Code: |
52112
e7d0572ccca5
(displayed-month, displayed-year): Define for compiler.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
47 |
93220 | 48 (require 'calendar) |
49 (require 'lunar) ; lunar-new-moon-on-or-after | |
50 ;; solar-date-next-longitude brought in by lunar. | |
51 ;;;(require 'solar) | |
93637
60b7d8c48c07
Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents:
93533
diff
changeset
|
52 ;; calendar-astro-to-absolute and from-absolute are cal-autoloads. |
93220 | 53 ;;;(require 'cal-julian) |
54 | |
13053 | 55 |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
56 (defgroup calendar-chinese nil |
92579
8ddfb879916b
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
92546
diff
changeset
|
57 "Chinese calendar support." |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
58 :prefix "calendar-chinese-" |
92579
8ddfb879916b
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
92546
diff
changeset
|
59 :group 'calendar) |
13053 | 60 |
94018
2834643ba8a0
(chinese-calendar-time-zone): Mark obsolete name as risky too.
Glenn Morris <rgm@gnu.org>
parents:
93993
diff
changeset
|
61 (define-obsolete-variable-alias 'chinese-calendar-time-zone |
2834643ba8a0
(chinese-calendar-time-zone): Mark obsolete name as risky too.
Glenn Morris <rgm@gnu.org>
parents:
93993
diff
changeset
|
62 'calendar-chinese-time-zone "23.1") |
2834643ba8a0
(chinese-calendar-time-zone): Mark obsolete name as risky too.
Glenn Morris <rgm@gnu.org>
parents:
93993
diff
changeset
|
63 |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
64 (defcustom calendar-chinese-time-zone |
13053 | 65 '(if (< year 1928) |
66 (+ 465 (/ 40.0 60.0)) | |
67 480) | |
92660
e64439fb46dc
(chinese-calendar-time-zone, chinese-calendar-daylight-time-offset)
Glenn Morris <rgm@gnu.org>
parents:
92642
diff
changeset
|
68 "Minutes difference between local standard time for Chinese calendar and UTC. |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
69 Default is for Beijing. This is an expression in `year' since it changed at |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
70 1928-01-01 00:00:00 from UT+7:45:40 to UT+8." |
19903
bfd7fbd77e8a
(chinese-calendar-time-zone): Likewise.
Richard M. Stallman <rms@gnu.org>
parents:
17624
diff
changeset
|
71 :type 'sexp |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
72 :group 'calendar-chinese) |
13053 | 73 |
93993
5310823a757f
(calendar-chinese-time-zone): Mark as risky.
Glenn Morris <rgm@gnu.org>
parents:
93844
diff
changeset
|
74 ;; It gets eval'd. |
5310823a757f
(calendar-chinese-time-zone): Mark as risky.
Glenn Morris <rgm@gnu.org>
parents:
93844
diff
changeset
|
75 ;;;###autoload |
5310823a757f
(calendar-chinese-time-zone): Mark as risky.
Glenn Morris <rgm@gnu.org>
parents:
93844
diff
changeset
|
76 (put 'calendar-chinese-time-zone 'risky-local-variable t) |
94018
2834643ba8a0
(chinese-calendar-time-zone): Mark obsolete name as risky too.
Glenn Morris <rgm@gnu.org>
parents:
93993
diff
changeset
|
77 ;;;###autoload |
2834643ba8a0
(chinese-calendar-time-zone): Mark obsolete name as risky too.
Glenn Morris <rgm@gnu.org>
parents:
93993
diff
changeset
|
78 (put 'chinese-calendar-time-zone 'risky-local-variable t) |
93993
5310823a757f
(calendar-chinese-time-zone): Mark as risky.
Glenn Morris <rgm@gnu.org>
parents:
93844
diff
changeset
|
79 |
94018
2834643ba8a0
(chinese-calendar-time-zone): Mark obsolete name as risky too.
Glenn Morris <rgm@gnu.org>
parents:
93993
diff
changeset
|
80 |
2834643ba8a0
(chinese-calendar-time-zone): Mark obsolete name as risky too.
Glenn Morris <rgm@gnu.org>
parents:
93993
diff
changeset
|
81 (define-obsolete-variable-alias 'chinese-calendar-location-name |
2834643ba8a0
(chinese-calendar-time-zone): Mark obsolete name as risky too.
Glenn Morris <rgm@gnu.org>
parents:
93993
diff
changeset
|
82 'calendar-chinese-location-name "23.1") |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
83 |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
84 ;; FIXME unused. |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
85 (defcustom calendar-chinese-location-name "Beijing" |
92546
0ef74aab4b13
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
79703
diff
changeset
|
86 "Name of location used for calculation of Chinese calendar." |
17624
7634c31da26e
Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
14685
diff
changeset
|
87 :type 'string |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
88 :group 'calendar-chinese) |
13053 | 89 |
94018
2834643ba8a0
(chinese-calendar-time-zone): Mark obsolete name as risky too.
Glenn Morris <rgm@gnu.org>
parents:
93993
diff
changeset
|
90 (define-obsolete-variable-alias 'chinese-calendar-daylight-time-offset |
2834643ba8a0
(chinese-calendar-time-zone): Mark obsolete name as risky too.
Glenn Morris <rgm@gnu.org>
parents:
93993
diff
changeset
|
91 'calendar-chinese-daylight-time-offset "23.1") |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
92 |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
93 (defcustom calendar-chinese-daylight-time-offset 0 |
92642 | 94 ;; The correct value is as follows, but the Chinese calendrical |
95 ;; authorities do NOT use DST in determining astronomical events: | |
96 ;; 60 | |
92660
e64439fb46dc
(chinese-calendar-time-zone, chinese-calendar-daylight-time-offset)
Glenn Morris <rgm@gnu.org>
parents:
92642
diff
changeset
|
97 "Minutes difference between daylight saving and standard time. |
e64439fb46dc
(chinese-calendar-time-zone, chinese-calendar-daylight-time-offset)
Glenn Morris <rgm@gnu.org>
parents:
92642
diff
changeset
|
98 Default is for no daylight saving time." |
17624
7634c31da26e
Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
14685
diff
changeset
|
99 :type 'integer |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
100 :group 'calendar-chinese) |
13053 | 101 |
94018
2834643ba8a0
(chinese-calendar-time-zone): Mark obsolete name as risky too.
Glenn Morris <rgm@gnu.org>
parents:
93993
diff
changeset
|
102 (define-obsolete-variable-alias 'chinese-calendar-standard-time-zone-name |
2834643ba8a0
(chinese-calendar-time-zone): Mark obsolete name as risky too.
Glenn Morris <rgm@gnu.org>
parents:
93993
diff
changeset
|
103 'calendar-chinese-standard-time-zone-name "23.1") |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
104 |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
105 (defcustom calendar-chinese-standard-time-zone-name |
13053 | 106 '(if (< year 1928) |
107 "PMT" | |
108 "CST") | |
92546
0ef74aab4b13
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
79703
diff
changeset
|
109 "Abbreviated name of standard time zone used for Chinese calendar. |
19903
bfd7fbd77e8a
(chinese-calendar-time-zone): Likewise.
Richard M. Stallman <rms@gnu.org>
parents:
17624
diff
changeset
|
110 This is an expression depending on `year' because it changed |
bfd7fbd77e8a
(chinese-calendar-time-zone): Likewise.
Richard M. Stallman <rms@gnu.org>
parents:
17624
diff
changeset
|
111 at 1928-01-01 00:00:00 from `PMT' to `CST'." |
bfd7fbd77e8a
(chinese-calendar-time-zone): Likewise.
Richard M. Stallman <rms@gnu.org>
parents:
17624
diff
changeset
|
112 :type 'sexp |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
113 :group 'calendar-chinese) |
13053 | 114 |
94018
2834643ba8a0
(chinese-calendar-time-zone): Mark obsolete name as risky too.
Glenn Morris <rgm@gnu.org>
parents:
93993
diff
changeset
|
115 (define-obsolete-variable-alias 'chinese-calendar-daylight-time-zone-name |
2834643ba8a0
(chinese-calendar-time-zone): Mark obsolete name as risky too.
Glenn Morris <rgm@gnu.org>
parents:
93993
diff
changeset
|
116 'calendar-chinese-daylight-time-zone-name "23.1") |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
117 |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
118 (defcustom calendar-chinese-daylight-time-zone-name "CDT" |
92546
0ef74aab4b13
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
79703
diff
changeset
|
119 "Abbreviated name of daylight saving time zone used for Chinese calendar." |
17624
7634c31da26e
Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
14685
diff
changeset
|
120 :type 'string |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
121 :group 'calendar-chinese) |
13053 | 122 |
94018
2834643ba8a0
(chinese-calendar-time-zone): Mark obsolete name as risky too.
Glenn Morris <rgm@gnu.org>
parents:
93993
diff
changeset
|
123 (define-obsolete-variable-alias 'chinese-calendar-daylight-savings-starts |
2834643ba8a0
(chinese-calendar-time-zone): Mark obsolete name as risky too.
Glenn Morris <rgm@gnu.org>
parents:
93993
diff
changeset
|
124 'calendar-chinese-daylight-saving-start "23.1") |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
125 |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
126 (defcustom calendar-chinese-daylight-saving-start nil |
92642 | 127 ;; The correct value is as follows, but the Chinese calendrical |
128 ;; authorities do NOT use DST in determining astronomical events: | |
129 ;; '(cond ((< 1986 year) (calendar-nth-named-day 1 0 4 year 10)) | |
130 ;; ((= 1986 year) '(5 4 1986)) | |
131 ;; (t nil)) | |
92660
e64439fb46dc
(chinese-calendar-time-zone, chinese-calendar-daylight-time-offset)
Glenn Morris <rgm@gnu.org>
parents:
92642
diff
changeset
|
132 "Sexp giving the date on which daylight saving time starts. |
e64439fb46dc
(chinese-calendar-time-zone, chinese-calendar-daylight-time-offset)
Glenn Morris <rgm@gnu.org>
parents:
92642
diff
changeset
|
133 Default is for no daylight saving time. See documentation of |
17624
7634c31da26e
Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
14685
diff
changeset
|
134 `calendar-daylight-savings-starts'." |
7634c31da26e
Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
14685
diff
changeset
|
135 :type 'sexp |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
136 :group 'calendar-chinese) |
13053 | 137 |
94018
2834643ba8a0
(chinese-calendar-time-zone): Mark obsolete name as risky too.
Glenn Morris <rgm@gnu.org>
parents:
93993
diff
changeset
|
138 (define-obsolete-variable-alias 'chinese-calendar-daylight-savings-ends |
2834643ba8a0
(chinese-calendar-time-zone): Mark obsolete name as risky too.
Glenn Morris <rgm@gnu.org>
parents:
93993
diff
changeset
|
139 'calendar-chinese-daylight-saving-end "23.1") |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
140 |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
141 (defcustom calendar-chinese-daylight-saving-end nil |
92642 | 142 ;; The correct value is as follows, but the Chinese calendrical |
143 ;; authorities do NOT use DST in determining astronomical events: | |
144 ;; '(if (<= 1986 year) (calendar-nth-named-day 1 0 9 year 11)) | |
92660
e64439fb46dc
(chinese-calendar-time-zone, chinese-calendar-daylight-time-offset)
Glenn Morris <rgm@gnu.org>
parents:
92642
diff
changeset
|
145 "Sexp giving the date on which daylight saving time ends. |
e64439fb46dc
(chinese-calendar-time-zone, chinese-calendar-daylight-time-offset)
Glenn Morris <rgm@gnu.org>
parents:
92642
diff
changeset
|
146 Default is for no daylight saving time. See documentation of |
17624
7634c31da26e
Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
14685
diff
changeset
|
147 `calendar-daylight-savings-ends'." |
7634c31da26e
Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
14685
diff
changeset
|
148 :type 'sexp |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
149 :group 'calendar-chinese) |
13053 | 150 |
94018
2834643ba8a0
(chinese-calendar-time-zone): Mark obsolete name as risky too.
Glenn Morris <rgm@gnu.org>
parents:
93993
diff
changeset
|
151 (define-obsolete-variable-alias 'chinese-calendar-daylight-savings-starts-time |
2834643ba8a0
(chinese-calendar-time-zone): Mark obsolete name as risky too.
Glenn Morris <rgm@gnu.org>
parents:
93993
diff
changeset
|
152 'calendar-chinese-daylight-saving-start-time "23.1") |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
153 |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
154 (defcustom calendar-chinese-daylight-saving-start-time 0 |
92660
e64439fb46dc
(chinese-calendar-time-zone, chinese-calendar-daylight-time-offset)
Glenn Morris <rgm@gnu.org>
parents:
92642
diff
changeset
|
155 "Number of minutes after midnight that daylight saving time starts. |
e64439fb46dc
(chinese-calendar-time-zone, chinese-calendar-daylight-time-offset)
Glenn Morris <rgm@gnu.org>
parents:
92642
diff
changeset
|
156 Default is for no daylight saving time." |
17624
7634c31da26e
Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
14685
diff
changeset
|
157 :type 'integer |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
158 :group 'calendar-chinese) |
13053 | 159 |
94018
2834643ba8a0
(chinese-calendar-time-zone): Mark obsolete name as risky too.
Glenn Morris <rgm@gnu.org>
parents:
93993
diff
changeset
|
160 (define-obsolete-variable-alias 'chinese-calendar-daylight-savings-ends-time |
2834643ba8a0
(chinese-calendar-time-zone): Mark obsolete name as risky too.
Glenn Morris <rgm@gnu.org>
parents:
93993
diff
changeset
|
161 'calendar-chinese-daylight-saving-end-time "23.1") |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
162 |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
163 (defcustom calendar-chinese-daylight-saving-end-time 0 |
92660
e64439fb46dc
(chinese-calendar-time-zone, chinese-calendar-daylight-time-offset)
Glenn Morris <rgm@gnu.org>
parents:
92642
diff
changeset
|
164 "Number of minutes after midnight that daylight saving time ends. |
e64439fb46dc
(chinese-calendar-time-zone, chinese-calendar-daylight-time-offset)
Glenn Morris <rgm@gnu.org>
parents:
92642
diff
changeset
|
165 Default is for no daylight saving time." |
17624
7634c31da26e
Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
14685
diff
changeset
|
166 :type 'integer |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
167 :group 'calendar-chinese) |
13053 | 168 |
94018
2834643ba8a0
(chinese-calendar-time-zone): Mark obsolete name as risky too.
Glenn Morris <rgm@gnu.org>
parents:
93993
diff
changeset
|
169 (define-obsolete-variable-alias 'chinese-calendar-celestial-stem |
2834643ba8a0
(chinese-calendar-time-zone): Mark obsolete name as risky too.
Glenn Morris <rgm@gnu.org>
parents:
93993
diff
changeset
|
170 'calendar-chinese-celestial-stem "23.1") |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
171 |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
172 (defcustom calendar-chinese-celestial-stem |
93090
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
173 ["Jia" "Yi" "Bing" "Ding" "Wu" "Ji" "Geng" "Xin" "Ren" "Gui"] |
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
174 "Prefixes used by `calendar-chinese-sexagesimal-name'." |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
175 :group 'calendar-chinese |
93090
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
176 :type '(vector (string :tag "Jia") |
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
177 (string :tag "Yi") |
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
178 (string :tag "Bing") |
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
179 (string :tag "Ding") |
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
180 (string :tag "Wu") |
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
181 (string :tag "Ji") |
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
182 (string :tag "Geng") |
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
183 (string :tag "Xin") |
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
184 (string :tag "Ren") |
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
185 (string :tag "Gui"))) |
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
186 |
94018
2834643ba8a0
(chinese-calendar-time-zone): Mark obsolete name as risky too.
Glenn Morris <rgm@gnu.org>
parents:
93993
diff
changeset
|
187 (define-obsolete-variable-alias 'chinese-calendar-terrestrial-branch |
2834643ba8a0
(chinese-calendar-time-zone): Mark obsolete name as risky too.
Glenn Morris <rgm@gnu.org>
parents:
93993
diff
changeset
|
188 'calendar-chinese-terrestrial-branch "23.1") |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
189 |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
190 (defcustom calendar-chinese-terrestrial-branch |
93090
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
191 ["Zi" "Chou" "Yin" "Mao" "Chen" "Si" "Wu" "Wei" "Shen" "You" "Xu" "Hai"] |
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
192 "Suffixes used by `calendar-chinese-sexagesimal-name'." |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
193 :group 'calendar-chinese |
93090
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
194 :type '(vector (string :tag "Zi") |
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
195 (string :tag "Chou") |
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
196 (string :tag "Yin") |
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
197 (string :tag "Mao") |
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
198 (string :tag "Chen") |
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
199 (string :tag "Si") |
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
200 (string :tag "Wu") |
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
201 (string :tag "Wei") |
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
202 (string :tag "Shen") |
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
203 (string :tag "You") |
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
204 (string :tag "Xu") |
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
205 (string :tag "Hai"))) |
9144c487a567
(chinese-calendar-celestial-stem, chinese-calendar-terrestrial-branch):
Glenn Morris <rgm@gnu.org>
parents:
92989
diff
changeset
|
206 |
92579
8ddfb879916b
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
92546
diff
changeset
|
207 ;;; End of user options. |
8ddfb879916b
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
92546
diff
changeset
|
208 |
8ddfb879916b
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
92546
diff
changeset
|
209 |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
210 (defun calendar-chinese-sexagesimal-name (n) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
211 "The N-th name of the Chinese sexagesimal cycle. |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
212 N congruent to 1 gives the first name, N congruent to 2 gives the second name, |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
213 ..., N congruent to 60 gives the sixtieth name." |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
214 (format "%s-%s" |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
215 (aref calendar-chinese-celestial-stem (% (1- n) 10)) |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
216 (aref calendar-chinese-terrestrial-branch (% (1- n) 12)))) |
92579
8ddfb879916b
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
92546
diff
changeset
|
217 |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
218 (defun calendar-chinese-zodiac-sign-on-or-after (d) |
92660
e64439fb46dc
(chinese-calendar-time-zone, chinese-calendar-daylight-time-offset)
Glenn Morris <rgm@gnu.org>
parents:
92642
diff
changeset
|
219 "Absolute date of first new Zodiac sign on or after absolute date D. |
13053 | 220 The Zodiac signs begin when the sun's longitude is a multiple of 30 degrees." |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93779
diff
changeset
|
221 (let* ((year (calendar-extract-year (calendar-gregorian-from-absolute d))) |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
222 (calendar-time-zone (eval calendar-chinese-time-zone)) ; uses year |
13053 | 223 (calendar-daylight-time-offset |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
224 calendar-chinese-daylight-time-offset) |
13053 | 225 (calendar-standard-time-zone-name |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
226 calendar-chinese-standard-time-zone-name) |
13053 | 227 (calendar-daylight-time-zone-name |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
228 calendar-chinese-daylight-time-zone-name) |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
229 (calendar-daylight-savings-starts |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
230 calendar-chinese-daylight-saving-start) |
13053 | 231 (calendar-daylight-savings-ends |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
232 calendar-chinese-daylight-saving-end) |
13053 | 233 (calendar-daylight-savings-starts-time |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
234 calendar-chinese-daylight-saving-start-time) |
13053 | 235 (calendar-daylight-savings-ends-time |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
236 calendar-chinese-daylight-saving-end-time)) |
13053 | 237 (floor |
93637
60b7d8c48c07
Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents:
93533
diff
changeset
|
238 (calendar-astro-to-absolute |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
239 (solar-date-next-longitude (calendar-astro-from-absolute d) 30))))) |
13053 | 240 |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
241 (defun calendar-chinese-new-moon-on-or-after (d) |
92660
e64439fb46dc
(chinese-calendar-time-zone, chinese-calendar-daylight-time-offset)
Glenn Morris <rgm@gnu.org>
parents:
92642
diff
changeset
|
242 "Absolute date of first new moon on or after absolute date D." |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93779
diff
changeset
|
243 (let* ((year (calendar-extract-year (calendar-gregorian-from-absolute d))) |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
244 (calendar-time-zone (eval calendar-chinese-time-zone)) |
13053 | 245 (calendar-daylight-time-offset |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
246 calendar-chinese-daylight-time-offset) |
13053 | 247 (calendar-standard-time-zone-name |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
248 calendar-chinese-standard-time-zone-name) |
13053 | 249 (calendar-daylight-time-zone-name |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
250 calendar-chinese-daylight-time-zone-name) |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
251 (calendar-daylight-savings-starts |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
252 calendar-chinese-daylight-saving-start) |
13053 | 253 (calendar-daylight-savings-ends |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
254 calendar-chinese-daylight-saving-end) |
13053 | 255 (calendar-daylight-savings-starts-time |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
256 calendar-chinese-daylight-saving-start-time) |
13053 | 257 (calendar-daylight-savings-ends-time |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
258 calendar-chinese-daylight-saving-end-time)) |
13053 | 259 (floor |
93637
60b7d8c48c07
Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents:
93533
diff
changeset
|
260 (calendar-astro-to-absolute |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
261 (lunar-new-moon-on-or-after (calendar-astro-from-absolute d)))))) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
262 |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
263 (defun calendar-chinese-month-list (start end) |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
264 "List of starting dates of Chinese months from START to END." |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
265 (if (<= start end) |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
266 (let ((new-moon (calendar-chinese-new-moon-on-or-after start))) |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
267 (if (<= new-moon end) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
268 (cons new-moon |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
269 (calendar-chinese-month-list (1+ new-moon) end)))))) |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
270 |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
271 (defun calendar-chinese-number-months (list start) |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
272 "Assign month numbers to the lunar months in LIST, starting with START. |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
273 Numbers are assigned sequentially, START, START+1, ..., 11, with |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
274 half numbers used for leap months. First and last months of list |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
275 are never leap months." |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
276 (when list |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
277 (cons (list start (car list)) ; first month |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
278 ;; Remaining months. |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
279 (if (zerop (- 12 start (length list))) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
280 ;; List is too short for a leap month. |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
281 (calendar-chinese-number-months (cdr list) (1+ start)) |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
282 (if (and (cddr list) ; at least two more months... |
92967
4151ef80cb37
(number-chinese-months, calendar-chinese-from-absolute): Use nth, caar.
Glenn Morris <rgm@gnu.org>
parents:
92900
diff
changeset
|
283 (<= (nth 2 list) |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
284 (calendar-chinese-zodiac-sign-on-or-after |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
285 (cadr list)))) |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
286 ;; Next month is a leap month. |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
287 (cons (list (+ start 0.5) (cadr list)) |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
288 (calendar-chinese-number-months (cddr list) (1+ start))) |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
289 ;; Next month is not a leap month. |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
290 (calendar-chinese-number-months (cdr list) (1+ start))))))) |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
291 |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
292 (defun calendar-chinese-compute-year (y) |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
293 "Compute the structure of the Chinese year for Gregorian year Y. |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
294 The result is a list of pairs (i d), where month i begins on absolute date d, |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
295 of the Chinese months from the Chinese month following the solstice in |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
296 Gregorian year Y-1 to the Chinese month of the solstice of Gregorian year Y." |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
297 (let* ((next-solstice (calendar-chinese-zodiac-sign-on-or-after |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
298 (calendar-absolute-from-gregorian |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
299 (list 12 15 y)))) |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
300 (list (calendar-chinese-month-list |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
301 (1+ (calendar-chinese-zodiac-sign-on-or-after |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
302 (calendar-absolute-from-gregorian |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
303 (list 12 15 (1- y))))) |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
304 next-solstice)) |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
305 (next-sign (calendar-chinese-zodiac-sign-on-or-after (car list)))) |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
306 (if (= (length list) 12) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
307 ;; No room for a leap month, just number them 12, 1, 2, ..., 11. |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
308 (cons (list 12 (car list)) |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
309 (calendar-chinese-number-months (cdr list) 1)) |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
310 ;; Now we can assign numbers to the list for y. |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
311 ;; The first month or two are special. |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
312 (if (or (> (car list) next-sign) (>= next-sign (cadr list))) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
313 ;; First month on list is a leap month, second is not. |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
314 (append (list (list 11.5 (car list)) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
315 (list 12 (cadr list))) |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
316 (calendar-chinese-number-months (cddr list) 1)) |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
317 ;; First month on list is not a leap month. |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
318 (append (list (list 12 (car list))) |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
319 (if (>= (calendar-chinese-zodiac-sign-on-or-after (cadr list)) |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
320 (nth 2 list)) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
321 ;; Second month on list is a leap month. |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
322 (cons (list 12.5 (cadr list)) |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
323 (calendar-chinese-number-months (cddr list) 1)) |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
324 ;; Second month on list is not a leap month. |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
325 (calendar-chinese-number-months (cdr list) 1))))))) |
13053 | 326 |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
327 (defvar calendar-chinese-year-cache |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
328 ;; Maintainers: delete existing value, position point at start of |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
329 ;; empty line, then call M-: (calendar-chinese-year-cache-init N) |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
330 '((2000 (12 730126) (1 730155) (2 730185) (3 730215) (4 730244) (5 730273) |
23143
cbd4013c57ab
(chinese-year-cache): Change range of years from
Karl Heuer <kwzh@gnu.org>
parents:
20462
diff
changeset
|
331 (6 730303) (7 730332) (8 730361) (9 730391) (10 730420) (11 730450)) |
cbd4013c57ab
(chinese-year-cache): Change range of years from
Karl Heuer <kwzh@gnu.org>
parents:
20462
diff
changeset
|
332 (2001 (12 730480) (1 730509) (2 730539) (3 730569) (4 730598) (4.5 730628) |
cbd4013c57ab
(chinese-year-cache): Change range of years from
Karl Heuer <kwzh@gnu.org>
parents:
20462
diff
changeset
|
333 (5 730657) (6 730687) (7 730716) (8 730745) (9 730775) (10 730804) |
cbd4013c57ab
(chinese-year-cache): Change range of years from
Karl Heuer <kwzh@gnu.org>
parents:
20462
diff
changeset
|
334 (11 730834)) |
cbd4013c57ab
(chinese-year-cache): Change range of years from
Karl Heuer <kwzh@gnu.org>
parents:
20462
diff
changeset
|
335 (2002 (12 730863) (1 730893) (2 730923) (3 730953) (4 730982) (5 731012) |
cbd4013c57ab
(chinese-year-cache): Change range of years from
Karl Heuer <kwzh@gnu.org>
parents:
20462
diff
changeset
|
336 (6 731041) (7 731071) (8 731100) (9 731129) (10 731159) (11 731188)) |
cbd4013c57ab
(chinese-year-cache): Change range of years from
Karl Heuer <kwzh@gnu.org>
parents:
20462
diff
changeset
|
337 (2003 (12 731218) (1 731247) (2 731277) (3 731307) (4 731336) (5 731366) |
cbd4013c57ab
(chinese-year-cache): Change range of years from
Karl Heuer <kwzh@gnu.org>
parents:
20462
diff
changeset
|
338 (6 731396) (7 731425) (8 731455) (9 731484) (10 731513) (11 731543)) |
cbd4013c57ab
(chinese-year-cache): Change range of years from
Karl Heuer <kwzh@gnu.org>
parents:
20462
diff
changeset
|
339 (2004 (12 731572) (1 731602) (2 731631) (2.5 731661) (3 731690) (4 731720) |
cbd4013c57ab
(chinese-year-cache): Change range of years from
Karl Heuer <kwzh@gnu.org>
parents:
20462
diff
changeset
|
340 (5 731750) (6 731779) (7 731809) (8 731838) (9 731868) (10 731897) |
cbd4013c57ab
(chinese-year-cache): Change range of years from
Karl Heuer <kwzh@gnu.org>
parents:
20462
diff
changeset
|
341 (11 731927)) |
cbd4013c57ab
(chinese-year-cache): Change range of years from
Karl Heuer <kwzh@gnu.org>
parents:
20462
diff
changeset
|
342 (2005 (12 731956) (1 731986) (2 732015) (3 732045) (4 732074) (5 732104) |
cbd4013c57ab
(chinese-year-cache): Change range of years from
Karl Heuer <kwzh@gnu.org>
parents:
20462
diff
changeset
|
343 (6 732133) (7 732163) (8 732193) (9 732222) (10 732252) (11 732281)) |
cbd4013c57ab
(chinese-year-cache): Change range of years from
Karl Heuer <kwzh@gnu.org>
parents:
20462
diff
changeset
|
344 (2006 (12 732311) (1 732340) (2 732370) (3 732399) (4 732429) (5 732458) |
cbd4013c57ab
(chinese-year-cache): Change range of years from
Karl Heuer <kwzh@gnu.org>
parents:
20462
diff
changeset
|
345 (6 732488) (7 732517) (7.5 732547) (8 732576) (9 732606) (10 732636) |
cbd4013c57ab
(chinese-year-cache): Change range of years from
Karl Heuer <kwzh@gnu.org>
parents:
20462
diff
changeset
|
346 (11 732665)) |
cbd4013c57ab
(chinese-year-cache): Change range of years from
Karl Heuer <kwzh@gnu.org>
parents:
20462
diff
changeset
|
347 (2007 (12 732695) (1 732725) (2 732754) (3 732783) (4 732813) (5 732842) |
cbd4013c57ab
(chinese-year-cache): Change range of years from
Karl Heuer <kwzh@gnu.org>
parents:
20462
diff
changeset
|
348 (6 732871) (7 732901) (8 732930) (9 732960) (10 732990) (11 733020)) |
cbd4013c57ab
(chinese-year-cache): Change range of years from
Karl Heuer <kwzh@gnu.org>
parents:
20462
diff
changeset
|
349 (2008 (12 733049) (1 733079) (2 733109) (3 733138) (4 733167) (5 733197) |
cbd4013c57ab
(chinese-year-cache): Change range of years from
Karl Heuer <kwzh@gnu.org>
parents:
20462
diff
changeset
|
350 (6 733226) (7 733255) (8 733285) (9 733314) (10 733344) (11 733374)) |
cbd4013c57ab
(chinese-year-cache): Change range of years from
Karl Heuer <kwzh@gnu.org>
parents:
20462
diff
changeset
|
351 (2009 (12 733403) (1 733433) (2 733463) (3 733493) (4 733522) (5 733551) |
cbd4013c57ab
(chinese-year-cache): Change range of years from
Karl Heuer <kwzh@gnu.org>
parents:
20462
diff
changeset
|
352 (5.5 733581) (6 733610) (7 733639) (8 733669) (9 733698) (10 733728) |
cbd4013c57ab
(chinese-year-cache): Change range of years from
Karl Heuer <kwzh@gnu.org>
parents:
20462
diff
changeset
|
353 (11 733757)) |
cbd4013c57ab
(chinese-year-cache): Change range of years from
Karl Heuer <kwzh@gnu.org>
parents:
20462
diff
changeset
|
354 (2010 (12 733787) (1 733817) (2 733847) (3 733876) (4 733906) (5 733935) |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
355 (6 733965) (7 733994) (8 734023) (9 734053) (10 734082) (11 734112)) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
356 (2011 (12 734141) (1 734171) (2 734201) (3 734230) (4 734260) (5 734290) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
357 (6 734319) (7 734349) (8 734378) (9 734407) (10 734437) (11 734466)) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
358 (2012 (12 734496) (1 734525) (2 734555) (3 734584) (4 734614) (4.5 734644) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
359 (5 734673) (6 734703) (7 734732) (8 734762) (9 734791) (10 734821) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
360 (11 734850)) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
361 (2013 (12 734880) (1 734909) (2 734939) (3 734968) (4 734998) (5 735027) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
362 (6 735057) (7 735087) (8 735116) (9 735146) (10 735175) (11 735205)) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
363 (2014 (12 735234) (1 735264) (2 735293) (3 735323) (4 735352) (5 735382) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
364 (6 735411) (7 735441) (8 735470) (9 735500) (9.5 735530) (10 735559) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
365 (11 735589)) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
366 (2015 (12 735618) (1 735648) (2 735677) (3 735707) (4 735736) (5 735765) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
367 (6 735795) (7 735824) (8 735854) (9 735884) (10 735914) (11 735943)) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
368 (2016 (12 735973) (1 736002) (2 736032) (3 736061) (4 736091) (5 736120) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
369 (6 736149) (7 736179) (8 736208) (9 736238) (10 736268) (11 736297)) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
370 (2017 (12 736327) (1 736357) (2 736386) (3 736416) (4 736445) (5 736475) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
371 (6 736504) (6.5 736533) (7 736563) (8 736592) (9 736622) (10 736651) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
372 (11 736681)) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
373 (2018 (12 736711) (1 736741) (2 736770) (3 736800) (4 736829) (5 736859) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
374 (6 736888) (7 736917) (8 736947) (9 736976) (10 737006) (11 737035)) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
375 (2019 (12 737065) (1 737095) (2 737125) (3 737154) (4 737184) (5 737213) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
376 (6 737243) (7 737272) (8 737301) (9 737331) (10 737360) (11 737389)) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
377 (2020 (12 737419) (1 737449) (2 737478) (3 737508) (4 737538) (4.5 737568) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
378 (5 737597) (6 737627) (7 737656) (8 737685) (9 737715) (10 737744) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
379 (11 737774))) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
380 "Alist of Chinese year structures as determined by `chinese-year'. |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
381 The default can be nil, but some values are precomputed for efficiency.") |
13281
510f946d1e22
Completely rewritten!
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13053
diff
changeset
|
382 |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
383 (defun calendar-chinese-year (y) |
13281
510f946d1e22
Completely rewritten!
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13053
diff
changeset
|
384 "The structure of the Chinese year for Gregorian year Y. |
13574
c5d4269e17d9
Minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13306
diff
changeset
|
385 The result is a list of pairs (i d), where month i begins on absolute date d, |
13281
510f946d1e22
Completely rewritten!
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13053
diff
changeset
|
386 of the Chinese months from the Chinese month following the solstice in |
510f946d1e22
Completely rewritten!
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13053
diff
changeset
|
387 Gregorian year Y-1 to the Chinese month of the solstice of Gregorian year Y. |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
388 The list is cached in `calendar-chinese-year-cache' for further use." |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
389 (let ((list (cdr (assoc y calendar-chinese-year-cache)))) |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
390 (or list |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
391 (setq list (calendar-chinese-compute-year y) |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
392 calendar-chinese-year-cache (append calendar-chinese-year-cache |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
393 (list (cons y list))))) |
13281
510f946d1e22
Completely rewritten!
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13053
diff
changeset
|
394 list)) |
510f946d1e22
Completely rewritten!
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13053
diff
changeset
|
395 |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
396 ;; Maintainer use. |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
397 (defun calendar-chinese-year-cache-init (year) |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
398 "Insert an initialization value for `calendar-chinese-year-cache' after point. |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
399 Computes values for 10 years either side of YEAR." |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
400 (setq year (- year 10)) |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
401 (let (calendar-chinese-year-cache end) |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
402 (save-excursion |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
403 (insert "'(") |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
404 (dotimes (n 21) |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
405 (princ (cons year (calendar-chinese-compute-year year)) |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
406 (current-buffer)) |
93533 | 407 (insert (if (= n 20) ")" "\n")) |
408 (setq year (1+ year))) | |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
409 (setq end (point))) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
410 (save-excursion |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
411 ;; fill-column -/+ 5. |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
412 (while (and (< (point) end) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
413 (re-search-forward "^.\\{65,75\\})" end t)) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
414 (delete-char 1) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
415 (insert "\n"))) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
416 (indent-region (point) end))) |
13281
510f946d1e22
Completely rewritten!
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13053
diff
changeset
|
417 |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
418 (defun calendar-chinese-to-absolute (date) |
13053 | 419 "The number of days elapsed between the Gregorian date 12/31/1 BC and DATE. |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
420 DATE is a Chinese date (cycle year month day). The Gregorian date |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
421 Sunday, December 31, 1 BC is imaginary." |
13053 | 422 (let* ((cycle (car date)) |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
423 (year (cadr date)) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
424 (month (nth 2 date)) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
425 (day (nth 3 date)) |
92642 | 426 (g-year (+ (* (1- cycle) 60) ; years in prior cycles |
427 (1- year) ; prior years this cycle | |
428 -2636))) ; years before absolute date 0 | |
429 (+ (1- day) ; prior days this month | |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
430 (cadr ; absolute date of start of this month |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
431 (assoc month (append (memq (assoc 1 (calendar-chinese-year g-year)) |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
432 (calendar-chinese-year g-year)) |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
433 (calendar-chinese-year (1+ g-year)))))))) |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
434 |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
435 (define-obsolete-function-alias 'calendar-absolute-from-chinese |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
436 'calendar-chinese-to-absolute "23.1") |
13053 | 437 |
438 (defun calendar-chinese-from-absolute (date) | |
439 "Compute Chinese date (cycle year month day) corresponding to absolute DATE. | |
440 The absolute date is the number of days elapsed since the (imaginary) | |
441 Gregorian date Sunday, December 31, 1 BC." | |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93779
diff
changeset
|
442 (let* ((g-year (calendar-extract-year |
13281
510f946d1e22
Completely rewritten!
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13053
diff
changeset
|
443 (calendar-gregorian-from-absolute date))) |
13574
c5d4269e17d9
Minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13306
diff
changeset
|
444 (c-year (+ g-year 2695)) |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
445 (list (append (calendar-chinese-year (1- g-year)) |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
446 (calendar-chinese-year g-year) |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
447 (calendar-chinese-year (1+ g-year))))) |
92967
4151ef80cb37
(number-chinese-months, calendar-chinese-from-absolute): Use nth, caar.
Glenn Morris <rgm@gnu.org>
parents:
92900
diff
changeset
|
448 (while (<= (cadr (cadr list)) date) |
92642 | 449 ;; The first month on the list is in Chinese year c-year. |
450 ;; Date is on or after start of second month on list... | |
92967
4151ef80cb37
(number-chinese-months, calendar-chinese-from-absolute): Use nth, caar.
Glenn Morris <rgm@gnu.org>
parents:
92900
diff
changeset
|
451 (if (= 1 (caar (cdr list))) |
92642 | 452 ;; Second month on list is a new Chinese year... |
13574
c5d4269e17d9
Minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13306
diff
changeset
|
453 (setq c-year (1+ c-year))) |
92642 | 454 ;; ...so first month on list is of no interest. |
13281
510f946d1e22
Completely rewritten!
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13053
diff
changeset
|
455 (setq list (cdr list))) |
13574
c5d4269e17d9
Minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13306
diff
changeset
|
456 (list (/ (1- c-year) 60) |
92989
130c0da046a4
(calendar-chinese-from-absolute, calendar-chinese-date-string): Expand
Glenn Morris <rgm@gnu.org>
parents:
92967
diff
changeset
|
457 ;; Remainder of c-year/60 with 60 instead of 0. |
130c0da046a4
(calendar-chinese-from-absolute, calendar-chinese-date-string): Expand
Glenn Morris <rgm@gnu.org>
parents:
92967
diff
changeset
|
458 (1+ (mod (1- c-year) 60)) |
92967
4151ef80cb37
(number-chinese-months, calendar-chinese-from-absolute): Use nth, caar.
Glenn Morris <rgm@gnu.org>
parents:
92900
diff
changeset
|
459 (caar list) |
4151ef80cb37
(number-chinese-months, calendar-chinese-from-absolute): Use nth, caar.
Glenn Morris <rgm@gnu.org>
parents:
92900
diff
changeset
|
460 (1+ (- date (cadr (car list))))))) |
13053 | 461 |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93779
diff
changeset
|
462 ;; Bound in calendar-generate. |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
463 (defvar displayed-month) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
464 (defvar displayed-year) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
465 |
92827
02fc7543d146
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92660
diff
changeset
|
466 ;;;###holiday-autoload |
13053 | 467 (defun holiday-chinese-new-year () |
93453
22b3710e206a
(holiday-chinese-new-year): Doc fix and comment.
Glenn Morris <rgm@gnu.org>
parents:
93220
diff
changeset
|
468 "Date of Chinese New Year, if visible in calendar. |
22b3710e206a
(holiday-chinese-new-year): Doc fix and comment.
Glenn Morris <rgm@gnu.org>
parents:
93220
diff
changeset
|
469 Returns (((MONTH DAY YEAR) TEXT)), where the date is Gregorian." |
13053 | 470 (let ((m displayed-month) |
93523
aa0e26f1d3ae
(holiday-chinese-new-year): Use a single let.
Glenn Morris <rgm@gnu.org>
parents:
93477
diff
changeset
|
471 (y displayed-year) |
aa0e26f1d3ae
(holiday-chinese-new-year): Use a single let.
Glenn Morris <rgm@gnu.org>
parents:
93477
diff
changeset
|
472 chinese-new-year) |
93453
22b3710e206a
(holiday-chinese-new-year): Doc fix and comment.
Glenn Morris <rgm@gnu.org>
parents:
93220
diff
changeset
|
473 ;; In the Gregorian calendar, CNY falls between Jan 21 and Feb 20. |
22b3710e206a
(holiday-chinese-new-year): Doc fix and comment.
Glenn Morris <rgm@gnu.org>
parents:
93220
diff
changeset
|
474 ;; Jan is visible if displayed-month = 12, 1, 2; Feb if d-m = 1, 2, 3. |
22b3710e206a
(holiday-chinese-new-year): Doc fix and comment.
Glenn Morris <rgm@gnu.org>
parents:
93220
diff
changeset
|
475 ;; If we shift the calendar forward one month, we can do a |
93454 | 476 ;; one-sided test, namely: d-m <= 4 means CNY might be visible. |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93779
diff
changeset
|
477 (calendar-increment-month m y 1) ; shift forward a month |
93523
aa0e26f1d3ae
(holiday-chinese-new-year): Use a single let.
Glenn Morris <rgm@gnu.org>
parents:
93477
diff
changeset
|
478 (and (< m 5) |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
479 (calendar-date-is-visible-p |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
480 (setq chinese-new-year |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
481 (calendar-gregorian-from-absolute |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
482 (cadr (assoc 1 (calendar-chinese-year y)))))) |
93523
aa0e26f1d3ae
(holiday-chinese-new-year): Use a single let.
Glenn Morris <rgm@gnu.org>
parents:
93477
diff
changeset
|
483 (list |
aa0e26f1d3ae
(holiday-chinese-new-year): Use a single let.
Glenn Morris <rgm@gnu.org>
parents:
93477
diff
changeset
|
484 (list chinese-new-year |
aa0e26f1d3ae
(holiday-chinese-new-year): Use a single let.
Glenn Morris <rgm@gnu.org>
parents:
93477
diff
changeset
|
485 (format "Chinese New Year (%s)" |
aa0e26f1d3ae
(holiday-chinese-new-year): Use a single let.
Glenn Morris <rgm@gnu.org>
parents:
93477
diff
changeset
|
486 (calendar-chinese-sexagesimal-name (+ y 57)))))))) |
13053 | 487 |
94282
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
488 ;;;###holiday-autoload |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
489 (defun holiday-chinese-qingming () |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
490 "Date of Chinese Qingming Festival, if visible in calendar. |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
491 Returns (((MONTH DAY YEAR) TEXT)), where the date is Gregorian." |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
492 (when (memq displayed-month '(3 4 5)) ; is April visible? |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
493 (list (list (calendar-gregorian-from-absolute |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
494 ;; 15 days after Vernal Equinox. |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
495 (+ 15 |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
496 (calendar-chinese-zodiac-sign-on-or-after |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
497 (calendar-absolute-from-gregorian |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
498 (list 3 15 displayed-year))))) |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
499 "Qingming Festival")))) |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
500 |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
501 ;;;###holiday-autoload |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
502 (defun holiday-chinese-winter-solstice () |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
503 "Date of Chinese winter solstice, if visible in calendar. |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
504 Returns (((MONTH DAY YEAR) TEXT)), where the date is Gregorian." |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
505 (when (memq displayed-month '(11 12 1)) ; is December visible? |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
506 (list (list (calendar-gregorian-from-absolute |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
507 (calendar-chinese-zodiac-sign-on-or-after |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
508 (calendar-absolute-from-gregorian |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
509 (list 12 15 (if (eq displayed-month 1) |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
510 (1- displayed-year) |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
511 displayed-year))))) |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
512 "Winter Solstice Festival")))) |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
513 |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
514 ;;;###holiday-autoload |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
515 (defun holiday-chinese (month day string) |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
516 "Holiday on Chinese MONTH, DAY called STRING. |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
517 If MONTH, DAY (Chinese) is visible, returns the corresponding |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
518 Gregorian date as the list (((month day year) STRING)). |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
519 Returns nil if it is not visible in the current calendar window." |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
520 ;; This is calendar-nongregorian-visible-p adapted for the form of |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
521 ;; chinese dates: (cycle year month day) as opposed to (month day year). |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
522 (let* ((m1 displayed-month) |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
523 (y1 displayed-year) |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
524 (m2 displayed-month) |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
525 (y2 displayed-year) |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
526 ;; Absolute date of first/last dates in calendar window. |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
527 (start-date (progn |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
528 (calendar-increment-month m1 y1 -1) |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
529 (calendar-absolute-from-gregorian (list m1 1 y1)))) |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
530 (end-date (progn |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
531 (calendar-increment-month m2 y2 1) |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
532 (calendar-absolute-from-gregorian |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
533 (list m2 (calendar-last-day-of-month m2 y2) y2)))) |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
534 ;; Local date of first/last date in calendar window. |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
535 (local-start (calendar-chinese-from-absolute start-date)) |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
536 ;; A basic optimization. We only care about the year part, |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
537 ;; and the Chinese year can only change if Jan or Feb are |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
538 ;; visible. FIXME can we do more? |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
539 (local-end (if (memq displayed-month '(12 1 2 3)) |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
540 (calendar-chinese-from-absolute end-date) |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
541 local-start)) |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
542 ;; When Chinese New Year is visible on the far right of the |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
543 ;; calendar, what is the earliest Chinese month in the |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
544 ;; previous year that might still visible? This test doesn't |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
545 ;; have to be precise. |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
546 (local (if (< month 10) local-end local-start)) |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
547 (cycle (car local)) |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
548 (year (cadr local)) |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
549 (date (calendar-gregorian-from-absolute |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
550 (calendar-chinese-to-absolute (list cycle year month day))))) |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
551 (if (calendar-date-is-visible-p date) |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
552 (list (list date string))))) |
70cc209bf336
(holiday-chinese-qingming, holiday-chinese-winter-solstice)
Glenn Morris <rgm@gnu.org>
parents:
94018
diff
changeset
|
553 |
92827
02fc7543d146
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92660
diff
changeset
|
554 ;;;###cal-autoload |
13053 | 555 (defun calendar-chinese-date-string (&optional date) |
556 "String of Chinese date of Gregorian DATE. | |
557 Defaults to today's date if DATE is not given." | |
558 (let* ((a-date (calendar-absolute-from-gregorian | |
559 (or date (calendar-current-date)))) | |
560 (c-date (calendar-chinese-from-absolute a-date)) | |
561 (cycle (car c-date)) | |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
562 (year (cadr c-date)) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
563 (month (nth 2 c-date)) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
564 (day (nth 3 c-date)) |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
565 (this-month (calendar-chinese-to-absolute |
13053 | 566 (list cycle year month 1))) |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
567 (next-month (calendar-chinese-to-absolute |
13283
f8658d1ca0f2
Various fixes and simplifications.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13281
diff
changeset
|
568 (list (if (= year 60) (1+ cycle) cycle) |
f8658d1ca0f2
Various fixes and simplifications.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13281
diff
changeset
|
569 (if (= (floor month) 12) (1+ year) year) |
92989
130c0da046a4
(calendar-chinese-from-absolute, calendar-chinese-date-string): Expand
Glenn Morris <rgm@gnu.org>
parents:
92967
diff
changeset
|
570 ;; Remainder of (1+(floor month))/12, with |
130c0da046a4
(calendar-chinese-from-absolute, calendar-chinese-date-string): Expand
Glenn Morris <rgm@gnu.org>
parents:
92967
diff
changeset
|
571 ;; 12 instead of 0. |
130c0da046a4
(calendar-chinese-from-absolute, calendar-chinese-date-string): Expand
Glenn Morris <rgm@gnu.org>
parents:
92967
diff
changeset
|
572 (1+ (mod (floor month) 12)) |
13283
f8658d1ca0f2
Various fixes and simplifications.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13281
diff
changeset
|
573 1))) |
13281
510f946d1e22
Completely rewritten!
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13053
diff
changeset
|
574 (m-cycle (% (+ (* year 5) (floor month)) 60))) |
13306
77d8e407592e
Fix the way the sexagisimal names are calculated.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13284
diff
changeset
|
575 (format "Cycle %s, year %s (%s), %smonth %s%s, day %s (%s)" |
13053 | 576 cycle |
13675
280cee006df8
(calendar-chinese-sexagesimal-name): Renamed from
Paul Eggert <eggert@twinsun.com>
parents:
13574
diff
changeset
|
577 year (calendar-chinese-sexagesimal-name year) |
13053 | 578 (if (not (integerp month)) |
579 "second " | |
580 (if (< 30 (- next-month this-month)) | |
581 "first " | |
582 "")) | |
13281
510f946d1e22
Completely rewritten!
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13053
diff
changeset
|
583 (floor month) |
13306
77d8e407592e
Fix the way the sexagisimal names are calculated.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13284
diff
changeset
|
584 (if (integerp month) |
13675
280cee006df8
(calendar-chinese-sexagesimal-name): Renamed from
Paul Eggert <eggert@twinsun.com>
parents:
13574
diff
changeset
|
585 (format " (%s)" (calendar-chinese-sexagesimal-name |
20215
13b173216a3d
(calendar-chinese-date-string): Fix month name.
Karl Heuer <kwzh@gnu.org>
parents:
19903
diff
changeset
|
586 (+ (* 12 year) month 50))) |
13306
77d8e407592e
Fix the way the sexagisimal names are calculated.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13284
diff
changeset
|
587 "") |
13675
280cee006df8
(calendar-chinese-sexagesimal-name): Renamed from
Paul Eggert <eggert@twinsun.com>
parents:
13574
diff
changeset
|
588 day (calendar-chinese-sexagesimal-name (+ a-date 15))))) |
13306
77d8e407592e
Fix the way the sexagisimal names are calculated.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13284
diff
changeset
|
589 |
92827
02fc7543d146
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92660
diff
changeset
|
590 ;;;###cal-autoload |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
591 (defun calendar-chinese-print-date () |
13053 | 592 "Show the Chinese date equivalents of date." |
593 (interactive) | |
594 (message "Computing Chinese date...") | |
595 (message "Chinese date: %s" | |
596 (calendar-chinese-date-string (calendar-cursor-to-date t)))) | |
597 | |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
598 (define-obsolete-function-alias 'calendar-print-chinese-date |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
599 'calendar-chinese-print-date "23.1") |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
600 |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
601 (defun calendar-chinese-months-to-alist (l) |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
602 "Make list of months L into an assoc list." |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
603 (and l (car l) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
604 (if (and (cdr l) (cadr l)) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
605 (if (= (car l) (floor (cadr l))) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
606 (append |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
607 (list (cons (format "%s (first)" (car l)) (car l)) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
608 (cons (format "%s (second)" (car l)) (cadr l))) |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
609 (calendar-chinese-months-to-alist (cddr l))) |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
610 (append |
93844
bf9ef749c23e
Replace int-to-string with number-to-string.
Glenn Morris <rgm@gnu.org>
parents:
93809
diff
changeset
|
611 (list (cons (number-to-string (car l)) (car l))) |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
612 (calendar-chinese-months-to-alist (cdr l)))) |
93844
bf9ef749c23e
Replace int-to-string with number-to-string.
Glenn Morris <rgm@gnu.org>
parents:
93809
diff
changeset
|
613 (list (cons (number-to-string (car l)) (car l)))))) |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
614 |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
615 (defun calendar-chinese-months (c y) |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
616 "A list of the months in cycle C, year Y of the Chinese calendar." |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
617 (memq 1 (append |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
618 (mapcar (lambda (x) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
619 (car x)) |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93779
diff
changeset
|
620 (calendar-chinese-year (calendar-extract-year |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
621 (calendar-gregorian-from-absolute |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
622 (calendar-chinese-to-absolute |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
623 (list c y 1 1)))))) |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
624 (mapcar (lambda (x) |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
625 (if (> (car x) 11) (car x))) |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93779
diff
changeset
|
626 (calendar-chinese-year (calendar-extract-year |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
627 (calendar-gregorian-from-absolute |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
628 (calendar-chinese-to-absolute |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
629 (list (if (= y 60) (1+ c) c) |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
630 (if (= y 60) 1 y) |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
631 1 1))))))))) |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
632 |
92827
02fc7543d146
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92660
diff
changeset
|
633 ;;;###cal-autoload |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
634 (defun calendar-chinese-goto-date (date &optional noecho) |
13053 | 635 "Move cursor to Chinese date DATE. |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
636 Echo Chinese date unless NOECHO is non-nil." |
13053 | 637 (interactive |
638 (let* ((c (calendar-chinese-from-absolute | |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
639 (calendar-absolute-from-gregorian (calendar-current-date)))) |
13053 | 640 (cycle (calendar-read |
13281
510f946d1e22
Completely rewritten!
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13053
diff
changeset
|
641 "Chinese calendar cycle number (>44): " |
92579
8ddfb879916b
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
92546
diff
changeset
|
642 (lambda (x) (> x 44)) |
93844
bf9ef749c23e
Replace int-to-string with number-to-string.
Glenn Morris <rgm@gnu.org>
parents:
93809
diff
changeset
|
643 (number-to-string (car c)))) |
13053 | 644 (year (calendar-read |
13281
510f946d1e22
Completely rewritten!
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13053
diff
changeset
|
645 "Year in Chinese cycle (1..60): " |
92579
8ddfb879916b
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
92546
diff
changeset
|
646 (lambda (x) (and (<= 1 x) (<= x 60))) |
93844
bf9ef749c23e
Replace int-to-string with number-to-string.
Glenn Morris <rgm@gnu.org>
parents:
93809
diff
changeset
|
647 (number-to-string (cadr c)))) |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
648 (month-list (calendar-chinese-months-to-alist |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
649 (calendar-chinese-months cycle year))) |
13281
510f946d1e22
Completely rewritten!
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13053
diff
changeset
|
650 (month (cdr (assoc |
510f946d1e22
Completely rewritten!
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13053
diff
changeset
|
651 (completing-read "Chinese calendar month: " |
510f946d1e22
Completely rewritten!
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13053
diff
changeset
|
652 month-list nil t) |
510f946d1e22
Completely rewritten!
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13053
diff
changeset
|
653 month-list))) |
510f946d1e22
Completely rewritten!
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13053
diff
changeset
|
654 (last (if (= month |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
655 (nth 2 |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
656 (calendar-chinese-from-absolute |
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
657 (+ 29 |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
658 (calendar-chinese-to-absolute |
92900
c6b7fe651716
Re-order so that functions are defined before use.
Glenn Morris <rgm@gnu.org>
parents:
92827
diff
changeset
|
659 (list cycle year month 1)))))) |
13281
510f946d1e22
Completely rewritten!
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13053
diff
changeset
|
660 30 |
510f946d1e22
Completely rewritten!
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13053
diff
changeset
|
661 29)) |
510f946d1e22
Completely rewritten!
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13053
diff
changeset
|
662 (day (calendar-read |
510f946d1e22
Completely rewritten!
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13053
diff
changeset
|
663 (format "Chinese calendar day (1-%d): " last) |
92579
8ddfb879916b
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
92546
diff
changeset
|
664 (lambda (x) (and (<= 1 x) (<= x last)))))) |
13053 | 665 (list (list cycle year month day)))) |
666 (calendar-goto-date (calendar-gregorian-from-absolute | |
93739
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
667 (calendar-chinese-to-absolute date))) |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
668 (or noecho (calendar-chinese-print-date))) |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
669 |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
670 (define-obsolete-function-alias 'calendar-goto-chinese-date |
14357375e115
(calendar-chinese): Rename custom group from chinese-calendar. Update users.
Glenn Morris <rgm@gnu.org>
parents:
93637
diff
changeset
|
671 'calendar-chinese-goto-date "23.1") |
13053 | 672 |
92614 | 673 (defvar date) |
674 | |
93779 | 675 ;; To be called from diary-list-sexp-entries, where DATE is bound. |
92827
02fc7543d146
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92660
diff
changeset
|
676 ;;;###diary-autoload |
13053 | 677 (defun diary-chinese-date () |
678 "Chinese calendar equivalent of date diary entry." | |
679 (format "Chinese date: %s" (calendar-chinese-date-string date))) | |
680 | |
14685
496342156d13
Renamed from cal-chinese.el to avoid 14-character limitation.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
681 (provide 'cal-china) |
13053 | 682 |
92579
8ddfb879916b
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
92546
diff
changeset
|
683 ;; arch-tag: 7e5b7e0d-676c-47e3-8696-93e7ea0ab644 |
14685
496342156d13
Renamed from cal-chinese.el to avoid 14-character limitation.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
684 ;;; cal-china.el ends here |