Mercurial > emacs
annotate lisp/calendar/cal-french.el @ 93637:60b7d8c48c07
Update for cal-julian name changes.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Fri, 04 Apr 2008 07:05:44 +0000 |
parents | 2aa65ff3876d |
children | 73275d7e89b7 |
rev | line source |
---|---|
38422
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
28781
diff
changeset
|
1 ;;; cal-french.el --- calendar functions for the French Revolutionary calendar |
957 | 2 |
67465
a55ee709ec8d
Update copyright pending Emacs 22.
Glenn Morris <rgm@gnu.org>
parents:
65145
diff
changeset
|
3 ;; Copyright (C) 1988, 1989, 1992, 1994, 1995, 1997, 2001, 2002, 2003, |
79703 | 4 ;; 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
957 | 5 |
6 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu> | |
67465
a55ee709ec8d
Update copyright pending Emacs 22.
Glenn Morris <rgm@gnu.org>
parents:
65145
diff
changeset
|
7 ;; Maintainer: Glenn Morris <rgm@gnu.org> |
2247
2c7997f249eb
Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1338
diff
changeset
|
8 ;; Keywords: calendar |
2c7997f249eb
Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1338
diff
changeset
|
9 ;; Human-Keywords: French Revolutionary calendar, calendar, diary |
957 | 10 |
11 ;; This file is part of GNU Emacs. | |
12 | |
6736
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5833
diff
changeset
|
13 ;; 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
|
14 ;; it under the terms of the GNU General Public License as published by |
78216
93e11478c954
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
15 ;; the Free Software Foundation; either version 3, or (at your option) |
6736
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5833
diff
changeset
|
16 ;; any later version. |
957 | 17 |
6736
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5833
diff
changeset
|
18 ;; 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
|
19 ;; 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
|
20 ;; 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
|
21 ;; 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
|
22 |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5833
diff
changeset
|
23 ;; You should have received a copy of the GNU General Public License |
14169 | 24 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64085 | 25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
26 ;; Boston, MA 02110-1301, USA. | |
957 | 27 |
28 ;;; Commentary: | |
29 | |
93480
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
30 ;; See calendar.el. |
957 | 31 |
32 ;;; Code: | |
33 | |
34 (require 'calendar) | |
35 | |
92905
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
36 (defconst french-calendar-epoch (calendar-absolute-from-gregorian '(9 22 1792)) |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
37 "Absolute date of start of French Revolutionary calendar = Sept 22, 1792.") |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
38 |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
39 (defconst french-calendar-month-name-array |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
40 ["Vende'miaire" "Brumaire" "Frimaire" "Nivo^se" "Pluvio^se" "Vento^se" |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
41 "Germinal" "Flore'al" "Prairial" "Messidor" "Thermidor" "Fructidor"] |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
42 "Array of month names in the French calendar.") |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
43 |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
44 (defconst french-calendar-multibyte-month-name-array |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
45 ["Vendémiaire" "Brumaire" "Frimaire" "Nivôse" "Pluviôse" "Ventôse" |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
46 "Germinal" "Floréal" "Prairial" "Messidor" "Thermidor" "Fructidor"] |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
47 "Array of multibyte month names in the French calendar.") |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
48 |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
49 (defconst french-calendar-day-name-array |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
50 ["Primidi" "Duodi" "Tridi" "Quartidi" "Quintidi" "Sextidi" "Septidi" |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
51 "Octidi" "Nonidi" "Decadi"] |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
52 "Array of day names in the French calendar.") |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
53 |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
54 (defconst french-calendar-special-days-array |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
55 ["de la Vertu" "du Ge'nie" "du Travail" "de la Raison" "des Re'compenses" |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
56 "de la Re'volution"] |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
57 "Array of special day names in the French calendar.") |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
58 |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
59 (defconst french-calendar-multibyte-special-days-array |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
60 ["de la Vertu" "du Génie" "du Travail" "de la Raison" "des Récompenses" |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
61 "de la Révolution"] |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
62 "Array of multibyte special day names in the French calendar.") |
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
63 |
19885
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
64 (defun french-calendar-accents () |
92964
943c6058b43a
(french-calendar-accents): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
92905
diff
changeset
|
65 "Return non-nil if diacritical marks are available." |
19885
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
66 (and (or window-system |
92851 | 67 (terminal-coding-system)) |
19885
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
68 (or enable-multibyte-characters |
92851 | 69 (and (char-table-p standard-display-table) |
70 (equal (aref standard-display-table 161) [161]))))) | |
15550
4df6e0ffab90
(french-calendar-accents): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
71 |
20474
2ff24b456bb7
(calendar-french-single-byteify): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20462
diff
changeset
|
72 (defun french-calendar-month-name-array () |
92629
3d76a52b916c
(french-calendar-month-name-array)
Glenn Morris <rgm@gnu.org>
parents:
92628
diff
changeset
|
73 "Return the array of month names, depending on whether accents are available." |
20474
2ff24b456bb7
(calendar-french-single-byteify): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20462
diff
changeset
|
74 (if (french-calendar-accents) |
2ff24b456bb7
(calendar-french-single-byteify): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20462
diff
changeset
|
75 french-calendar-multibyte-month-name-array |
2ff24b456bb7
(calendar-french-single-byteify): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20462
diff
changeset
|
76 french-calendar-month-name-array)) |
2ff24b456bb7
(calendar-french-single-byteify): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20462
diff
changeset
|
77 |
2ff24b456bb7
(calendar-french-single-byteify): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20462
diff
changeset
|
78 (defun french-calendar-day-name-array () |
92629
3d76a52b916c
(french-calendar-month-name-array)
Glenn Morris <rgm@gnu.org>
parents:
92628
diff
changeset
|
79 "Return the array of day names." |
20474
2ff24b456bb7
(calendar-french-single-byteify): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20462
diff
changeset
|
80 french-calendar-day-name-array) |
2ff24b456bb7
(calendar-french-single-byteify): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20462
diff
changeset
|
81 |
20393
6f1b751fc31d
(french-calendar-special-days-array): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20245
diff
changeset
|
82 (defun french-calendar-special-days-array () |
92629
3d76a52b916c
(french-calendar-month-name-array)
Glenn Morris <rgm@gnu.org>
parents:
92628
diff
changeset
|
83 "Return the special day names, depending on whether accents are available." |
20393
6f1b751fc31d
(french-calendar-special-days-array): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20245
diff
changeset
|
84 (if (french-calendar-accents) |
6f1b751fc31d
(french-calendar-special-days-array): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20245
diff
changeset
|
85 french-calendar-multibyte-special-days-array |
6f1b751fc31d
(french-calendar-special-days-array): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20245
diff
changeset
|
86 french-calendar-special-days-array)) |
6f1b751fc31d
(french-calendar-special-days-array): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20245
diff
changeset
|
87 |
957 | 88 (defun french-calendar-leap-year-p (year) |
89 "True if YEAR is a leap year on the French Revolutionary calendar. | |
90 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
|
91 calendar, follows historical practice based on equinoxes (years 3, 7, |
957 | 92 and 11 were leap years; 15 and 20 would have been leap years). For later |
93 years uses the proposed rule of Romme (never adopted)--leap years fall every | |
94 four years except century years not divisible 400 and century years that are | |
95 multiples of 4000." | |
92628 | 96 (or (memq year '(3 7 11)) ; actual practice--based on equinoxes |
97 (memq year '(15 20)) ; anticipated practice--based on equinoxes | |
98 (and (> year 20) ; Romme's proposal--never adopted | |
957 | 99 (zerop (% year 4)) |
100 (not (memq (% year 400) '(100 200 300))) | |
101 (not (zerop (% year 4000)))))) | |
102 | |
103 (defun french-calendar-last-day-of-month (month year) | |
1338 | 104 "Return last day of MONTH, YEAR on the French Revolutionary calendar. |
957 | 105 The 13th month is not really a month, but the 5 (6 in leap years) day period of |
106 `sansculottides' at the end of the year." | |
107 (if (< month 13) | |
108 30 | |
109 (if (french-calendar-leap-year-p year) | |
110 6 | |
111 5))) | |
112 | |
113 (defun calendar-absolute-from-french (date) | |
1338 | 114 "Compute absolute date from French Revolutionary date DATE. |
957 | 115 The absolute date is the number of days elapsed since the (imaginary) |
116 Gregorian date Sunday, December 31, 1 BC." | |
117 (let ((month (extract-calendar-month date)) | |
118 (day (extract-calendar-day date)) | |
119 (year (extract-calendar-year date))) | |
92628 | 120 (+ (* 365 (1- year)) ; days in prior years |
121 ;; Leap days in prior years. | |
957 | 122 (if (< year 20) |
92628 | 123 (/ year 4) ; actual and anticipated practice (years 3, 7, 11, 15) |
124 ;; Romme's proposed rule (using the Principle of Inclusion/Exclusion). | |
125 (+ (/ (1- year) 4) ; luckily, there were 4 leap years before year 20 | |
957 | 126 (- (/ (1- year) 100)) |
127 (/ (1- year) 400) | |
128 (- (/ (1- year) 4000)))) | |
92628 | 129 (* 30 (1- month)) ; days in prior months this year |
130 day ; days so far this month | |
131 (1- french-calendar-epoch)))) ; days before start of calendar | |
957 | 132 |
133 (defun calendar-french-from-absolute (date) | |
1338 | 134 "Compute the French Revolutionary equivalent for absolute date DATE. |
135 The result is a list of the form (MONTH DAY YEAR). | |
136 The absolute date is the number of days elapsed since the | |
7639 | 137 \(imaginary) Gregorian date Sunday, December 31, 1 BC." |
13048 | 138 (if (< date french-calendar-epoch) |
92628 | 139 (list 0 0 0) ; pre-French Revolutionary date |
140 (let* ((approx ; approximation from below | |
13048 | 141 (/ (- date french-calendar-epoch) 366)) |
92628 | 142 (year ; search forward from the approximation |
957 | 143 (+ approx |
144 (calendar-sum y approx | |
92851 | 145 (>= date (calendar-absolute-from-french |
146 (list 1 1 (1+ y)))) | |
147 1))) | |
92628 | 148 (month ; search forward from Vendemiaire |
957 | 149 (1+ (calendar-sum m 1 |
92851 | 150 (> date |
151 (calendar-absolute-from-french | |
152 (list m | |
153 (french-calendar-last-day-of-month | |
154 m year) | |
155 year))) | |
156 1))) | |
92628 | 157 (day ; calculate the day by subtraction |
957 | 158 (- date |
159 (1- (calendar-absolute-from-french (list month 1 year)))))) | |
92851 | 160 (list month day year)))) |
957 | 161 |
92829
8777b384ba72
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92629
diff
changeset
|
162 ;;;###cal-autoload |
5699
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
163 (defun calendar-french-date-string (&optional date) |
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
164 "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
|
165 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
|
166 Defaults to today's date if DATE is not given." |
957 | 167 (let* ((french-date (calendar-french-from-absolute |
168 (calendar-absolute-from-gregorian | |
5699
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
169 (or date (calendar-current-date))))) |
957 | 170 (y (extract-calendar-year french-date)) |
171 (m (extract-calendar-month french-date)) | |
172 (d (extract-calendar-day french-date))) | |
5699
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
173 (cond |
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
174 ((< y 1) "") |
19885
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
175 ((= m 13) (format (if (french-calendar-accents) |
15550
4df6e0ffab90
(french-calendar-accents): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
176 "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
|
177 "Jour %s de l'Anne'e %d de la Re'volution") |
20393
6f1b751fc31d
(french-calendar-special-days-array): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20245
diff
changeset
|
178 (aref (french-calendar-special-days-array) (1- d)) |
5699
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
179 y)) |
15550
4df6e0ffab90
(french-calendar-accents): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
180 (t (format |
19885
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
181 (if (french-calendar-accents) |
28781
dc2a0cf401ab
(french-calendar-multibyte-special-days-array)
Gerd Moellmann <gerd@gnu.org>
parents:
24191
diff
changeset
|
182 "%d %s an %d de la Révolution" |
dc2a0cf401ab
(french-calendar-multibyte-special-days-array)
Gerd Moellmann <gerd@gnu.org>
parents:
24191
diff
changeset
|
183 "%d %s an %d de la Re'volution") |
dc2a0cf401ab
(french-calendar-multibyte-special-days-array)
Gerd Moellmann <gerd@gnu.org>
parents:
24191
diff
changeset
|
184 d |
19885
266e93ddaf0e
(french-calendar-accents): Change variable to function.
Richard M. Stallman <rms@gnu.org>
parents:
17570
diff
changeset
|
185 (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
|
186 y))))) |
5699
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
187 |
92829
8777b384ba72
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92629
diff
changeset
|
188 ;;;###cal-autoload |
5699
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
189 (defun calendar-print-french-date () |
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
190 "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
|
191 (interactive) |
20763
129b8b78151c
(calendar-french-single-byteify): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
20474
diff
changeset
|
192 (let ((f (calendar-french-date-string (calendar-cursor-to-date t)))) |
5699
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
193 (if (string-equal f "") |
957 | 194 (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
|
195 (message "French Revolutionary date: %s" f)))) |
957 | 196 |
92829
8777b384ba72
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92629
diff
changeset
|
197 ;;;###cal-autoload |
957 | 198 (defun calendar-goto-french-date (date &optional noecho) |
1338 | 199 "Move cursor to French Revolutionary date DATE. |
92905
0cea6abac18e
(french-calendar-accents): Move definition after constants.
Glenn Morris <rgm@gnu.org>
parents:
92851
diff
changeset
|
200 Echo French Revolutionary date unless NOECHO is non-nil." |
957 | 201 (interactive |
93480
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
202 (let* ((months (french-calendar-month-name-array)) |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
203 (special-days (french-calendar-special-days-array)) |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
204 (year (progn |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
205 (calendar-read |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
206 (if (french-calendar-accents) |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
207 "Année de la Révolution (>0): " |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
208 "Anne'e de la Re'volution (>0): ") |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
209 (lambda (x) (> x 0)) |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
210 (int-to-string |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
211 (extract-calendar-year |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
212 (calendar-french-from-absolute |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
213 (calendar-absolute-from-gregorian |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
214 (calendar-current-date)))))))) |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
215 (month-list |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
216 (mapcar 'list |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
217 (append months |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
218 (if (french-calendar-leap-year-p year) |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
219 (mapcar |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
220 (lambda (x) (concat "Jour " x)) |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
221 french-calendar-special-days-array) |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
222 (reverse |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
223 (cdr ; we don't want rev. day in a non-leap yr |
92851 | 224 (reverse |
93480
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
225 (mapcar |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
226 (lambda (x) |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
227 (concat "Jour " x)) |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
228 special-days)))))))) |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
229 (completion-ignore-case t) |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
230 (month (cdr (assoc-string |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
231 (completing-read |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
232 "Mois ou Sansculottide: " |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
233 month-list |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
234 nil t) |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
235 (calendar-make-alist month-list 1 'car) t))) |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
236 (day (if (> month 12) |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
237 (- month 12) |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
238 (calendar-read |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
239 "Jour (1-30): " |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
240 (lambda (x) (and (<= 1 x) (<= x 30)))))) |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
241 (month (if (> month 12) 13 month))) |
2aa65ff3876d
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
92964
diff
changeset
|
242 (list (list month day year)))) |
957 | 243 (calendar-goto-date (calendar-gregorian-from-absolute |
244 (calendar-absolute-from-french date))) | |
245 (or noecho (calendar-print-french-date))) | |
246 | |
92612 | 247 (defvar date) |
248 | |
249 ;; To be called from list-sexp-diary-entries, where DATE is bound. | |
92829
8777b384ba72
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92629
diff
changeset
|
250 ;;;###diary-autoload |
957 | 251 (defun diary-french-date () |
252 "French calendar equivalent of date diary entry." | |
17381
d1fc8a2d353f
(diary-french-date): Use `date'.
Richard M. Stallman <rms@gnu.org>
parents:
15550
diff
changeset
|
253 (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
|
254 (if (string-equal f "") |
a2d78b648542
(calendar-french-date-string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5416
diff
changeset
|
255 "Date is pre-French Revolution" |
17381
d1fc8a2d353f
(diary-french-date): Use `date'.
Richard M. Stallman <rms@gnu.org>
parents:
15550
diff
changeset
|
256 (format "French Revolutionary date: %s" f)))) |
957 | 257 |
258 (provide 'cal-french) | |
259 | |
92582
68c1d9ecc30d
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
79703
diff
changeset
|
260 ;; arch-tag: 7e8045a3-8609-46b5-9cde-cf40ce541cf9 |
957 | 261 ;;; cal-french.el ends here |