diff options
| author | Richard M. Stallman | 1994-01-30 00:29:32 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-01-30 00:29:32 +0000 |
| commit | adaeaa8e59ee767533a145400baf83da75ec4386 (patch) | |
| tree | 5c8c4e280575ec2e03365dc69bc1bc155dd433c9 | |
| parent | abd93e6653e6b0314f67e5f5971c116529a10d5e (diff) | |
| download | emacs-adaeaa8e59ee767533a145400baf83da75ec4386.tar.gz emacs-adaeaa8e59ee767533a145400baf83da75ec4386.zip | |
(calendar-french-date-string): New function.
(calendar-print-french-date, diary-french-date): Use it.
| -rw-r--r-- | lisp/calendar/cal-french.el | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/lisp/calendar/cal-french.el b/lisp/calendar/cal-french.el index 4a528eb0aa0..b2572e56f98 100644 --- a/lisp/calendar/cal-french.el +++ b/lisp/calendar/cal-french.el | |||
| @@ -127,27 +127,36 @@ The absolute date is the number of days elapsed since the | |||
| 127 | (1- (calendar-absolute-from-french (list month 1 year)))))) | 127 | (1- (calendar-absolute-from-french (list month 1 year)))))) |
| 128 | (list month day year)))) | 128 | (list month day year)))) |
| 129 | 129 | ||
| 130 | (defun calendar-print-french-date () | 130 | (defun calendar-french-date-string (&optional date) |
| 131 | "Show the French Revolutionary calendar equivalent of the selected date." | 131 | "String of French Revolutionary date of Gregorian DATE. |
| 132 | (interactive) | 132 | Returns the empty string if DATE is pre-French Revolutionary. |
| 133 | Defaults to today's date if DATE is not given." | ||
| 133 | (let* ((french-date (calendar-french-from-absolute | 134 | (let* ((french-date (calendar-french-from-absolute |
| 134 | (calendar-absolute-from-gregorian | 135 | (calendar-absolute-from-gregorian |
| 135 | (or (calendar-cursor-to-date) | 136 | (or date (calendar-current-date))))) |
| 136 | (error "Cursor is not on a date!"))))) | ||
| 137 | (y (extract-calendar-year french-date)) | 137 | (y (extract-calendar-year french-date)) |
| 138 | (m (extract-calendar-month french-date)) | 138 | (m (extract-calendar-month french-date)) |
| 139 | (d (extract-calendar-day french-date))) | 139 | (d (extract-calendar-day french-date))) |
| 140 | (if (< y 1) | 140 | (cond |
| 141 | ((< y 1) "") | ||
| 142 | ((= m 13) (format "Jour %s de l'Anne'e %d de la Revolution" | ||
| 143 | (aref french-calendar-special-days-array (1- d)) | ||
| 144 | y)) | ||
| 145 | (t (format "Decade %s, %s de %s de l'Anne'e %d de la Revolution" | ||
| 146 | (make-string (1+ (/ (1- d) 10)) ?I) | ||
| 147 | (aref french-calendar-day-name-array (% (1- d) 10)) | ||
| 148 | (aref french-calendar-month-name-array (1- m)) | ||
| 149 | y))))) | ||
| 150 | |||
| 151 | (defun calendar-print-french-date () | ||
| 152 | "Show the French Revolutionary calendar equivalent of the selected date." | ||
| 153 | (interactive) | ||
| 154 | (let ((f (calendar-french-date-string | ||
| 155 | (or (calendar-cursor-to-date) | ||
| 156 | (error "Cursor is not on a date!"))))) | ||
| 157 | (if (string-equal f "") | ||
| 141 | (message "Date is pre-French Revolution") | 158 | (message "Date is pre-French Revolution") |
| 142 | (if (= m 13) | 159 | (message f)))) |
| 143 | (message "Jour %s de l'Anne'e %d de la Revolution" | ||
| 144 | (aref french-calendar-special-days-array (1- d)) | ||
| 145 | y) | ||
| 146 | (message "Decade %s, %s de %s de l'Anne'e %d de la Revolution" | ||
| 147 | (make-string (1+ (/ (1- d) 10)) ?I) | ||
| 148 | (aref french-calendar-day-name-array (% (1- d) 10)) | ||
| 149 | (aref french-calendar-month-name-array (1- m)) | ||
| 150 | y))))) | ||
| 151 | 160 | ||
| 152 | (defun calendar-goto-french-date (date &optional noecho) | 161 | (defun calendar-goto-french-date (date &optional noecho) |
| 153 | "Move cursor to French Revolutionary date DATE. | 162 | "Move cursor to French Revolutionary date DATE. |
| @@ -204,21 +213,12 @@ Echo French Revolutionary date unless NOECHO is t." | |||
| 204 | 213 | ||
| 205 | (defun diary-french-date () | 214 | (defun diary-french-date () |
| 206 | "French calendar equivalent of date diary entry." | 215 | "French calendar equivalent of date diary entry." |
| 207 | (let* ((french-date (calendar-french-from-absolute | 216 | (let ((f (calendar-french-date-string |
| 208 | (calendar-absolute-from-gregorian date))) | 217 | (or (calendar-cursor-to-date) |
| 209 | (y (extract-calendar-year french-date)) | 218 | (error "Cursor is not on a date!"))))) |
| 210 | (m (extract-calendar-month french-date)) | 219 | (if (string-equal f "") |
| 211 | (d (extract-calendar-day french-date))) | 220 | "Date is pre-French Revolution" |
| 212 | (if (> y 0) | 221 | f))) |
| 213 | (if (= m 13) | ||
| 214 | (format "Jour %s de l'Anne'e %d de la Revolution" | ||
| 215 | (aref french-calendar-special-days-array (1- d)) | ||
| 216 | y) | ||
| 217 | (format "Decade %s, %s de %s de l'Anne'e %d de la Revolution" | ||
| 218 | (make-string (1+ (/ (1- d) 10)) ?I) | ||
| 219 | (aref french-calendar-day-name-array (% (1- d) 10)) | ||
| 220 | (aref french-calendar-month-name-array (1- m)) | ||
| 221 | y))))) | ||
| 222 | 222 | ||
| 223 | (provide 'cal-french) | 223 | (provide 'cal-french) |
| 224 | 224 | ||