Mercurial > emacs
annotate lisp/calendar/cal-french.el @ 19976:81065d2158f9
(term-if-emacs19): Recognize version 20.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Wed, 24 Sep 1997 16:38:24 +0000 |
parents | 266e93ddaf0e |
children | 78d833878a81 |
rev | line source |
---|---|
957 | 1 ;;; cal-french.el --- calendar functions for the French Revolutionary calendar. |
2 | |
19885
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
3 ;; Copyright (C) 1988, 89, 92, 94, 95, 1997 Free Software Foundation, Inc. |
957 | 4 |
5 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu> | |
2247
2c7997f249eb
Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1338
diff
changeset
|
6 ;; Keywords: calendar |
2c7997f249eb
Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1338
diff
changeset
|
7 ;; Human-Keywords: French Revolutionary calendar, calendar, diary |
957 | 8 |
9 ;; This file is part of GNU Emacs. | |
10 | |
6736
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5833
diff
changeset
|
11 ;; GNU Emacs is free software; you can redistribute it and/or modify |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5833
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5833
diff
changeset
|
13 ;; the Free Software Foundation; either version 2, or (at your option) |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5833
diff
changeset
|
14 ;; any later version. |
957 | 15 |
6736
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5833
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5833
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5833
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5833
diff
changeset
|
19 ;; GNU General Public License for more details. |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5833
diff
changeset
|
20 |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5833
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
14169 | 22 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
24 ;; Boston, MA 02111-1307, USA. | |
957 | 25 |
26 ;;; Commentary: | |
27 | |
28 ;; This collection of functions implements the features of calendar.el and | |
29 ;; diary.el that deal with the French Revolutionary calendar. | |
30 | |
7761
b6ac896a491a
Fix typo: Mayan -> French Revolutionary
Paul Eggert <eggert@twinsun.com>
parents:
7639
diff
changeset
|
31 ;; Technical details of the French Revolutionary calendar can be found in |
15550
4df6e0ffab90
(french-calendar-accents): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
32 ;; ``Calendrical Calculations, Part II: Three Historical Calendars'' by |
4df6e0ffab90
(french-calendar-accents): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
33 ;; E. M. Reingold, N. Dershowitz, and S. M. Clamen, Software--Practice and |
4df6e0ffab90
(french-calendar-accents): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
34 ;; Experience, Volume 23, Number 4 (April, 1993), pages 383-404. |
957 | 35 |
36 ;; Comments, corrections, and improvements should be sent to | |
37 ;; Edward M. Reingold Department of Computer Science | |
38 ;; (217) 333-6733 University of Illinois at Urbana-Champaign | |
39 ;; reingold@cs.uiuc.edu 1304 West Springfield Avenue | |
40 ;; Urbana, Illinois 61801 | |
41 | |
42 ;;; Code: | |
43 | |
44 (require 'calendar) | |
45 | |
19885
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
46 (defun french-calendar-accents () |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
47 "True if diacritical marks are available." |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
48 (and (or window-system |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
49 (terminal-coding-system)) |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
50 (or enable-multibyte-characters |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
51 (and (char-table-p standard-display-table) |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
52 (equal (aref standard-display-table 161) [161]))))) |
15550
4df6e0ffab90
(french-calendar-accents): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
53 |
13048 | 54 (defconst french-calendar-epoch (calendar-absolute-from-gregorian '(9 22 1792)) |
55 "Absolute date of start of French Revolutionary calendar = September 22, 1792.") | |
56 | |
957 | 57 (defconst french-calendar-month-name-array |
19885
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
58 ["Vende'miaire" "Brumaire" "Frimaire" "Nivo^se" "Pluvio^se" "Vento^se" |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
59 "Germinal" "Flore'al" "Prairial" "Messidor" "Thermidor" "Fructidor"]) |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
60 |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
61 (defconst french-calendar-multibyte-month-name-array |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
62 ["Vendémiaire" "Brumaire" "Frimaire" "Nivôse" "Pluviôse" "Ventôse" |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
63 "Germinal" "Floréal" "Prairial" "Messidor" "Thermidor" "Fructidor"]) |
957 | 64 |
65 (defconst french-calendar-day-name-array | |
66 ["Primidi" "Duodi" "Tridi" "Quartidi" "Quintidi" "Sextidi" "Septidi" | |
67 "Octidi" "Nonidi" "Decadi"]) | |
68 | |
19885
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
69 (defconst french-calendar-multibyte-special-days-array |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
70 ["de la Vertu" "du Génie" "du Labour" "de la Raison" |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
71 "de la Récompense" "de la Révolution"]) |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
72 |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
73 (defun french-calendar-month-name-array () |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
74 (if (french-calendar-accents) |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
75 french-calendar-multibyte-month-name-array |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
76 french-calendar-month-name-array)) |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
77 |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
78 (defun french-calendar-day-name-array () |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
79 (if (french-calendar-accents) |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
80 french-calendar-multibyte-month-name-array |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
81 french-calendar-month-name-array)) |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
82 |
957 | 83 (defconst french-calendar-special-days-array |
19885
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
84 ["de la Vertu" "du Ge'nie" "du Labour" "de la Raison" "de la Re'compense" |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
85 "de la Re'volution"]) |
957 | 86 |
87 (defun french-calendar-leap-year-p (year) | |
88 "True if YEAR is a leap year on the French Revolutionary calendar. | |
89 For Gregorian years 1793 to 1805, the years of actual operation of the | |
19885
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
90 calendar, follows historical practice based on equinoxes (years 3, 7, |
957 | 91 and 11 were leap years; 15 and 20 would have been leap years). For later |
92 years uses the proposed rule of Romme (never adopted)--leap years fall every | |
93 four years except century years not divisible 400 and century years that are | |
94 multiples of 4000." | |
95 (or (memq year '(3 7 11));; Actual practice--based on equinoxes | |
96 (memq year '(15 20)) ;; Anticipated practice--based on equinoxes | |
97 (and (> year 20) ;; Romme's proposal--never adopted | |
98 (zerop (% year 4)) | |
99 (not (memq (% year 400) '(100 200 300))) | |
100 (not (zerop (% year 4000)))))) | |
101 | |
102 (defun french-calendar-last-day-of-month (month year) | |
1338 | 103 "Return last day of MONTH, YEAR on the French Revolutionary calendar. |
957 | 104 The 13th month is not really a month, but the 5 (6 in leap years) day period of |
105 `sansculottides' at the end of the year." | |
106 (if (< month 13) | |
107 30 | |
108 (if (french-calendar-leap-year-p year) | |
109 6 | |
110 5))) | |
111 | |
112 (defun calendar-absolute-from-french (date) | |
1338 | 113 "Compute absolute date from French Revolutionary date DATE. |
957 | 114 The absolute date is the number of days elapsed since the (imaginary) |
115 Gregorian date Sunday, December 31, 1 BC." | |
116 (let ((month (extract-calendar-month date)) | |
117 (day (extract-calendar-day date)) | |
118 (year (extract-calendar-year date))) | |
119 (+ (* 365 (1- year));; Days in prior years | |
120 ;; Leap days in prior years | |
121 (if (< year 20) | |
122 (/ year 4);; Actual and anticipated practice (years 3, 7, 11, 15) | |
123 ;; Romme's proposed rule (using the Principle of Inclusion/Exclusion) | |
124 (+ (/ (1- year) 4);; Luckily, there were 4 leap years before year 20 | |
125 (- (/ (1- year) 100)) | |
126 (/ (1- year) 400) | |
127 (- (/ (1- year) 4000)))) | |
128 (* 30 (1- month));; Days in prior months this year | |
129 day;; Days so far this month | |
13048 | 130 (1- french-calendar-epoch))));; Days before start of calendar |
957 | 131 |
132 (defun calendar-french-from-absolute (date) | |
1338 | 133 "Compute the French Revolutionary equivalent for absolute date DATE. |
134 The result is a list of the form (MONTH DAY YEAR). | |
135 The absolute date is the number of days elapsed since the | |
7639 | 136 \(imaginary) Gregorian date Sunday, December 31, 1 BC." |
13048 | 137 (if (< date french-calendar-epoch) |
957 | 138 (list 0 0 0);; pre-French Revolutionary date |
13048 | 139 (let* ((approx ;; Approximation from below. |
140 (/ (- date french-calendar-epoch) 366)) | |
957 | 141 (year ;; Search forward from the approximation. |
142 (+ approx | |
143 (calendar-sum y approx | |
144 (>= date (calendar-absolute-from-french (list 1 1 (1+ y)))) | |
145 1))) | |
146 (month ;; Search forward from Vendemiaire. | |
147 (1+ (calendar-sum m 1 | |
148 (> date | |
149 (calendar-absolute-from-french | |
150 (list m | |
151 (french-calendar-last-day-of-month m year) | |
152 year))) | |
153 1))) | |
154 (day ;; Calculate the day by subtraction. | |
155 (- date | |
156 (1- (calendar-absolute-from-french (list month 1 year)))))) | |
157 (list month day year)))) | |
158 | |
5699
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
159 (defun calendar-french-date-string (&optional date) |
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
160 "String of French Revolutionary date of Gregorian DATE. |
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
161 Returns the empty string if DATE is pre-French Revolutionary. |
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
162 Defaults to today's date if DATE is not given." |
957 | 163 (let* ((french-date (calendar-french-from-absolute |
164 (calendar-absolute-from-gregorian | |
5699
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
165 (or date (calendar-current-date))))) |
957 | 166 (y (extract-calendar-year french-date)) |
167 (m (extract-calendar-month french-date)) | |
168 (d (extract-calendar-day french-date))) | |
5699
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
169 (cond |
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
170 ((< y 1) "") |
19885
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
171 ((= m 13) (format (if (french-calendar-accents) |
15550
4df6e0ffab90
(french-calendar-accents): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
172 "Jour %s de l'Année %d de la Révolution" |
4df6e0ffab90
(french-calendar-accents): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
173 "Jour %s de l'Anne'e %d de la Re'volution") |
5699
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
174 (aref french-calendar-special-days-array (1- d)) |
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
175 y)) |
15550
4df6e0ffab90
(french-calendar-accents): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
176 (t (format |
19885
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
177 (if (french-calendar-accents) |
15550
4df6e0ffab90
(french-calendar-accents): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
178 "Décade %s, %s de %s de l'Année %d de la Révolution" |
4df6e0ffab90
(french-calendar-accents): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
179 "De'cade %s, %s de %s de l'Anne'e %d de la Re'volution") |
4df6e0ffab90
(french-calendar-accents): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
180 (make-string (1+ (/ (1- d) 10)) ?I) |
19885
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
181 (aref (french-calendar-day-name-array) (% (1- d) 10)) |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
182 (aref (french-calendar-month-name-array) (1- m)) |
15550
4df6e0ffab90
(french-calendar-accents): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
183 y))))) |
5699
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
184 |
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
185 (defun calendar-print-french-date () |
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
186 "Show the French Revolutionary calendar equivalent of the selected date." |
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
187 (interactive) |
19885
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
188 (let ((f (calendar-french-date-string (calendar-cursor-to-date t))) |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
189 (enable-multibyte-characters t)) |
5699
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
190 (if (string-equal f "") |
957 | 191 (message "Date is pre-French Revolution") |
17570
daaffe2dece5
(calendar-print-french-date): Label French date in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
17381
diff
changeset
|
192 (message "French Revolutionary date: %s" f)))) |
957 | 193 |
194 (defun calendar-goto-french-date (date &optional noecho) | |
1338 | 195 "Move cursor to French Revolutionary date DATE. |
957 | 196 Echo French Revolutionary date unless NOECHO is t." |
197 (interactive | |
19885
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
198 (let* ((oldval enable-multibyte-characters) |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
199 (year (unwind-protect |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
200 (progn |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
201 (setq-default enable-multibyte-characters t) |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
202 (calendar-read |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
203 (if (french-calendar-accents) |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
204 "Année de la Révolution (>0): " |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
205 "Anne'e de la Re'volution (>0): ") |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
206 '(lambda (x) (> x 0)) |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
207 (int-to-string |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
208 (extract-calendar-year |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
209 (calendar-french-from-absolute |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
210 (calendar-absolute-from-gregorian |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
211 (calendar-current-date))))))) |
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
212 (setq-default enable-multibyte-characters oldval))) |
957 | 213 (month-list |
214 (mapcar 'list | |
19885
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
215 (append (french-calendar-month-name-array) |
957 | 216 (if (french-calendar-leap-year-p year) |
217 (mapcar | |
218 '(lambda (x) (concat "Jour " x)) | |
219 french-calendar-special-days-array) | |
13048 | 220 (reverse |
957 | 221 (cdr;; we don't want rev. day in a non-leap yr. |
13048 | 222 (reverse |
957 | 223 (mapcar |
224 '(lambda (x) (concat "Jour " x)) | |
5416
3733a396e16a
(calendar-goto-french-date): Fix special day
Richard M. Stallman <rms@gnu.org>
parents:
2945
diff
changeset
|
225 french-calendar-special-days-array)))))))) |
957 | 226 (completion-ignore-case t) |
227 (month (cdr (assoc | |
228 (capitalize | |
229 (completing-read | |
230 "Mois ou Sansculottide: " | |
231 month-list | |
232 nil t)) | |
233 (calendar-make-alist | |
234 month-list | |
235 1 | |
236 '(lambda (x) (capitalize (car x))))))) | |
237 (decade (if (> month 12) | |
238 1 | |
239 (calendar-read | |
19885
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
240 (if (french-calendar-accents) |
15550
4df6e0ffab90
(french-calendar-accents): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
241 "Décade (1-3): " |
4df6e0ffab90
(french-calendar-accents): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
242 "De'cade (1-3): ") |
957 | 243 '(lambda (x) (memq x '(1 2 3)))))) |
244 (day (if (> month 12) | |
245 (- month 12) | |
246 (calendar-read | |
5416
3733a396e16a
(calendar-goto-french-date): Fix special day
Richard M. Stallman <rms@gnu.org>
parents:
2945
diff
changeset
|
247 "Jour (1-10): " |
957 | 248 '(lambda (x) (and (<= 1 x) (<= x 10)))))) |
249 (month (if (> month 12) 13 month)) | |
250 (day (+ day (* 10 (1- decade))))) | |
251 (list (list month day year)))) | |
252 (calendar-goto-date (calendar-gregorian-from-absolute | |
253 (calendar-absolute-from-french date))) | |
254 (or noecho (calendar-print-french-date))) | |
255 | |
256 (defun diary-french-date () | |
257 "French calendar equivalent of date diary entry." | |
17381
d1fc8a2d353f
(diary-french-date): Use `date'.
Richard M. Stallman <rms@gnu.org>
parents:
15550
diff
changeset
|
258 (let ((f (calendar-french-date-string date))) |
5699
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
259 (if (string-equal f "") |
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
260 "Date is pre-French Revolution" |
17381
d1fc8a2d353f
(diary-french-date): Use `date'.
Richard M. Stallman <rms@gnu.org>
parents:
15550
diff
changeset
|
261 (format "French Revolutionary date: %s" f)))) |
957 | 262 |
263 (provide 'cal-french) | |
264 | |
265 ;;; cal-french.el ends here |