Mercurial > emacs
annotate lisp/calendar/cal-coptic.el @ 97774:cf6404e22e31
*** empty log message ***
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Wed, 27 Aug 2008 20:21:31 +0000 |
parents | e49abd957e81 |
children | a9dc0e7c3f2b |
rev | line source |
---|---|
38422
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
24190
diff
changeset
|
1 ;;; cal-coptic.el --- calendar functions for the Coptic/Ethiopic calendars |
13053 | 2 |
92966
446f7aee7bf1
(coptic-calendar-epoch): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
92897
diff
changeset
|
3 ;; Copyright (C) 1995, 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007, |
446f7aee7bf1
(coptic-calendar-epoch): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
92897
diff
changeset
|
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:
65145
diff
changeset
|
7 ;; Maintainer: Glenn Morris <rgm@gnu.org> |
13053 | 8 ;; Keywords: calendar |
9 ;; Human-Keywords: Coptic calendar, Ethiopic calendar, calendar, 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:
93844
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:
93844
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:
93844
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:
93844
diff
changeset
|
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
13053 | 25 |
26 ;;; Commentary: | |
27 | |
93478
022b9c621dbe
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93221
diff
changeset
|
28 ;; See calendar.el. |
20462
d179de7ad92e
Add reference to new Calendrical Calculations book.
Paul Eggert <eggert@twinsun.com>
parents:
20209
diff
changeset
|
29 |
13053 | 30 ;;; Code: |
31 | |
93221
546789da9d8f
Require calendar rather than cal-julian.
Glenn Morris <rgm@gnu.org>
parents:
93182
diff
changeset
|
32 (require 'calendar) |
65145
ac895e21e622
(date): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64085
diff
changeset
|
33 |
92613
28583a8ab749
(coptic-name): Add doc string.
Glenn Morris <rgm@gnu.org>
parents:
92580
diff
changeset
|
34 ;; Not constants because they get let-bound. |
13053 | 35 |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
36 (defvar calendar-coptic-month-name-array |
14568
60730f9e6b80
Coorect Ethiopic epoch and some spelling errors.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
14169
diff
changeset
|
37 ["Tut" "Babah" "Hatur" "Kiyahk" "Tubah" "Amshir" "Baramhat" "Barmundah" |
92897 | 38 "Bashans" "Baunah" "Abib" "Misra" "al-Nasi"] |
39 "Array of the month names in the Coptic calendar.") | |
13053 | 40 |
93221
546789da9d8f
Require calendar rather than cal-julian.
Glenn Morris <rgm@gnu.org>
parents:
93182
diff
changeset
|
41 (eval-and-compile |
93638
bab9812286c1
Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents:
93478
diff
changeset
|
42 (autoload 'calendar-julian-to-absolute "cal-julian")) |
93221
546789da9d8f
Require calendar rather than cal-julian.
Glenn Morris <rgm@gnu.org>
parents:
93182
diff
changeset
|
43 |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
44 (defvar calendar-coptic-epoch |
93638
bab9812286c1
Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents:
93478
diff
changeset
|
45 (eval-when-compile (calendar-julian-to-absolute '(8 29 284))) |
92966
446f7aee7bf1
(coptic-calendar-epoch): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
92897
diff
changeset
|
46 "Absolute date of start of Coptic calendar = August 29, 284 AD (Julian).") |
13053 | 47 |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
48 (defvar calendar-coptic-name "Coptic" |
92613
28583a8ab749
(coptic-name): Add doc string.
Glenn Morris <rgm@gnu.org>
parents:
92580
diff
changeset
|
49 "Used in some message strings.") |
13053 | 50 |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
51 (defun calendar-coptic-leap-year-p (year) |
13053 | 52 "True if YEAR is a leap year on the Coptic calendar." |
53 (zerop (mod (1+ year) 4))) | |
54 | |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
55 (defun calendar-coptic-last-day-of-month (month year) |
13053 | 56 "Return last day of MONTH, YEAR on the Coptic calendar. |
57 The 13th month is not really a month, but the 5 (6 in leap years) day period of | |
92627 | 58 Nisi (Kebus) at the end of the year." |
13053 | 59 (if (< month 13) |
60 30 | |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
61 (if (calendar-coptic-leap-year-p year) |
13053 | 62 6 |
63 5))) | |
64 | |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
65 (defun calendar-coptic-to-absolute (date) |
13053 | 66 "Compute absolute date from Coptic date DATE. |
67 The absolute date is the number of days elapsed since the (imaginary) | |
68 Gregorian date Sunday, December 31, 1 BC." | |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93780
diff
changeset
|
69 (let ((month (calendar-extract-month date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93780
diff
changeset
|
70 (day (calendar-extract-day date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93780
diff
changeset
|
71 (year (calendar-extract-year date))) |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
72 (+ (1- calendar-coptic-epoch) ; days before start of calendar |
92897 | 73 (* 365 (1- year)) ; days in prior years |
74 (/ year 4) ; leap days in prior years | |
75 (* 30 (1- month)) ; days in prior months this year | |
76 day))) ; days so far this month | |
13053 | 77 |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
78 (define-obsolete-function-alias 'calendar-absolute-from-coptic |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
79 'calendar-coptic-to-absolute "23.1") |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
80 |
13053 | 81 (defun calendar-coptic-from-absolute (date) |
82 "Compute the Coptic equivalent for absolute date DATE. | |
83 The result is a list of the form (MONTH DAY YEAR). | |
84 The absolute date is the number of days elapsed since the imaginary | |
85 Gregorian date Sunday, December 31, 1 BC." | |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
86 (if (< date calendar-coptic-epoch) |
92627 | 87 (list 0 0 0) ; pre-Coptic date |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
88 (let* ((approx (/ (- date calendar-coptic-epoch) |
92897 | 89 366)) ; approximation from below |
90 (year ; search forward from the approximation | |
13053 | 91 (+ approx |
92 (calendar-sum y approx | |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
93 (>= date (calendar-coptic-to-absolute |
92897 | 94 (list 1 1 (1+ y)))) |
95 1))) | |
92627 | 96 (month ; search forward from Tot |
13053 | 97 (1+ (calendar-sum m 1 |
92897 | 98 (> date |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
99 (calendar-coptic-to-absolute |
92897 | 100 (list m |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
101 (calendar-coptic-last-day-of-month m |
92897 | 102 year) |
103 year))) | |
104 1))) | |
92627 | 105 (day ; calculate the day by subtraction |
13053 | 106 (- date |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
107 (1- (calendar-coptic-to-absolute (list month 1 year)))))) |
92897 | 108 (list month day year)))) |
13053 | 109 |
92828
5d415a63a344
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92627
diff
changeset
|
110 ;;;###cal-autoload |
13053 | 111 (defun calendar-coptic-date-string (&optional date) |
112 "String of Coptic date of Gregorian DATE. | |
113 Returns the empty string if DATE is pre-Coptic calendar. | |
114 Defaults to today's date if DATE is not given." | |
115 (let* ((coptic-date (calendar-coptic-from-absolute | |
116 (calendar-absolute-from-gregorian | |
117 (or date (calendar-current-date))))) | |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93780
diff
changeset
|
118 (y (calendar-extract-year coptic-date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93780
diff
changeset
|
119 (m (calendar-extract-month coptic-date))) |
13053 | 120 (if (< y 1) |
121 "" | |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
122 (let ((monthname (aref calendar-coptic-month-name-array (1- m))) |
93844
bf9ef749c23e
Replace int-to-string with number-to-string.
Glenn Morris <rgm@gnu.org>
parents:
93809
diff
changeset
|
123 (day (number-to-string (calendar-extract-day coptic-date))) |
13053 | 124 (dayname nil) |
93844
bf9ef749c23e
Replace int-to-string with number-to-string.
Glenn Morris <rgm@gnu.org>
parents:
93809
diff
changeset
|
125 (month (number-to-string m)) |
bf9ef749c23e
Replace int-to-string with number-to-string.
Glenn Morris <rgm@gnu.org>
parents:
93809
diff
changeset
|
126 (year (number-to-string y))) |
13053 | 127 (mapconcat 'eval calendar-date-display-form ""))))) |
128 | |
92828
5d415a63a344
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92627
diff
changeset
|
129 ;;;###cal-autoload |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
130 (defun calendar-coptic-print-date () |
13053 | 131 "Show the Coptic calendar equivalent of the selected date." |
132 (interactive) | |
133 (let ((f (calendar-coptic-date-string (calendar-cursor-to-date t)))) | |
134 (if (string-equal f "") | |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
135 (message "Date is pre-%s calendar" calendar-coptic-name) |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
136 (message "%s date: %s" calendar-coptic-name f)))) |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
137 |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
138 (define-obsolete-function-alias 'calendar-print-coptic-date |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
139 'calendar-coptic-print-date "23.1") |
13053 | 140 |
93182
6011e8a7280f
(calendar-coptic-read-date): New name for coptic-prompt-for-date.
Glenn Morris <rgm@gnu.org>
parents:
92966
diff
changeset
|
141 (defun calendar-coptic-read-date () |
6011e8a7280f
(calendar-coptic-read-date): New name for coptic-prompt-for-date.
Glenn Morris <rgm@gnu.org>
parents:
92966
diff
changeset
|
142 "Interactively read the arguments for a Coptic date command. |
6011e8a7280f
(calendar-coptic-read-date): New name for coptic-prompt-for-date.
Glenn Morris <rgm@gnu.org>
parents:
92966
diff
changeset
|
143 Reads a year, month, and day." |
13053 | 144 (let* ((today (calendar-current-date)) |
145 (year (calendar-read | |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
146 (format "%s calendar year (>0): " calendar-coptic-name) |
92580
2a9b05a547d4
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
79703
diff
changeset
|
147 (lambda (x) (> x 0)) |
93844
bf9ef749c23e
Replace int-to-string with number-to-string.
Glenn Morris <rgm@gnu.org>
parents:
93809
diff
changeset
|
148 (number-to-string |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93780
diff
changeset
|
149 (calendar-extract-year |
13053 | 150 (calendar-coptic-from-absolute |
151 (calendar-absolute-from-gregorian today)))))) | |
152 (completion-ignore-case t) | |
54072
7cd960d120ba
(coptic-prompt-for-date): Use assoc-string instead of assoc-ignore-case.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
153 (month (cdr (assoc-string |
24190
77853cf5a2e5
(coptic-prompt-for-date): Use assoc-ignore-case and do not capitalize
Richard M. Stallman <rms@gnu.org>
parents:
20462
diff
changeset
|
154 (completing-read |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
155 (format "%s calendar month name: " calendar-coptic-name) |
24190
77853cf5a2e5
(coptic-prompt-for-date): Use assoc-ignore-case and do not capitalize
Richard M. Stallman <rms@gnu.org>
parents:
20462
diff
changeset
|
156 (mapcar 'list |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
157 (append calendar-coptic-month-name-array nil)) |
24190
77853cf5a2e5
(coptic-prompt-for-date): Use assoc-ignore-case and do not capitalize
Richard M. Stallman <rms@gnu.org>
parents:
20462
diff
changeset
|
158 nil t) |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
159 (calendar-make-alist calendar-coptic-month-name-array |
54072
7cd960d120ba
(coptic-prompt-for-date): Use assoc-string instead of assoc-ignore-case.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
160 1) t))) |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
161 (last (calendar-coptic-last-day-of-month month year)) |
13053 | 162 (day (calendar-read |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
163 (format "%s calendar day (1-%d): " calendar-coptic-name last) |
92580
2a9b05a547d4
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
79703
diff
changeset
|
164 (lambda (x) (and (< 0 x) (<= x last)))))) |
13053 | 165 (list (list month day year)))) |
166 | |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
167 (define-obsolete-function-alias 'coptic-prompt-for-date |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
168 'calendar-coptic-read-date "23.1") |
93182
6011e8a7280f
(calendar-coptic-read-date): New name for coptic-prompt-for-date.
Glenn Morris <rgm@gnu.org>
parents:
92966
diff
changeset
|
169 |
92897 | 170 ;;;###cal-autoload |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
171 (defun calendar-coptic-goto-date (date &optional noecho) |
92897 | 172 "Move cursor to Coptic date DATE. |
173 Echo Coptic date unless NOECHO is t." | |
93182
6011e8a7280f
(calendar-coptic-read-date): New name for coptic-prompt-for-date.
Glenn Morris <rgm@gnu.org>
parents:
92966
diff
changeset
|
174 (interactive (calendar-coptic-read-date)) |
92897 | 175 (calendar-goto-date (calendar-gregorian-from-absolute |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
176 (calendar-coptic-to-absolute date))) |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
177 (or noecho (calendar-coptic-print-date))) |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
178 |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
179 (define-obsolete-function-alias 'calendar-goto-coptic-date |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
180 'calendar-coptic-goto-date "23.1") |
92897 | 181 |
92622 | 182 (defvar date) |
183 | |
93780 | 184 ;; To be called from diary-list-sexp-entries, where DATE is bound. |
92828
5d415a63a344
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92627
diff
changeset
|
185 ;;;###diary-autoload |
13053 | 186 (defun diary-coptic-date () |
187 "Coptic calendar equivalent of date diary entry." | |
17383
dade44f8a6b0
(diary-coptic-date): Use `date'.
Richard M. Stallman <rms@gnu.org>
parents:
14568
diff
changeset
|
188 (let ((f (calendar-coptic-date-string date))) |
13053 | 189 (if (string-equal f "") |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
190 (format "Date is pre-%s calendar" calendar-coptic-name) |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
191 (format "%s date: %s" calendar-coptic-name f)))) |
13053 | 192 |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
193 (defconst calendar-ethiopic-month-name-array |
14568
60730f9e6b80
Coorect Ethiopic epoch and some spelling errors.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
14169
diff
changeset
|
194 ["Maskaram" "Teqemt" "Khedar" "Takhsas" "Ter" "Yakatit" "Magabit" "Miyazya" |
92897 | 195 "Genbot" "Sane" "Hamle" "Nahas" "Paguem"] |
196 "Array of the month names in the Ethiopic calendar.") | |
13053 | 197 |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
198 (defconst calendar-ethiopic-epoch 2796 |
20209
fd00ceeb06c6
(ethiopic-calendar-epoch): Correct to 8 CE.
Karl Heuer <kwzh@gnu.org>
parents:
17571
diff
changeset
|
199 "Absolute date of start of Ethiopic calendar = August 29, 8 C.E. (Julian).") |
13053 | 200 |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
201 (defconst calendar-ethiopic-name "Ethiopic" |
92897 | 202 "Used in some message strings.") |
13053 | 203 |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
204 (defun calendar-ethiopic-to-absolute (date) |
13053 | 205 "Compute absolute date from Ethiopic date DATE. |
206 The absolute date is the number of days elapsed since the (imaginary) | |
207 Gregorian date Sunday, December 31, 1 BC." | |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
208 (let ((calendar-coptic-epoch calendar-ethiopic-epoch)) |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
209 (calendar-coptic-to-absolute date))) |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
210 |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
211 (define-obsolete-function-alias 'calendar-absolute-from-ethiopic |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
212 'calendar-ethiopic-to-absolute "23.1") |
13053 | 213 |
214 (defun calendar-ethiopic-from-absolute (date) | |
215 "Compute the Ethiopic equivalent for absolute date DATE. | |
216 The result is a list of the form (MONTH DAY YEAR). | |
217 The absolute date is the number of days elapsed since the imaginary | |
218 Gregorian date Sunday, December 31, 1 BC." | |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
219 (let ((calendar-coptic-epoch calendar-ethiopic-epoch)) |
13053 | 220 (calendar-coptic-from-absolute date))) |
221 | |
92828
5d415a63a344
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92627
diff
changeset
|
222 ;;;###cal-autoload |
13053 | 223 (defun calendar-ethiopic-date-string (&optional date) |
224 "String of Ethiopic date of Gregorian DATE. | |
225 Returns the empty string if DATE is pre-Ethiopic calendar. | |
226 Defaults to today's date if DATE is not given." | |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
227 (let ((calendar-coptic-epoch calendar-ethiopic-epoch) |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
228 (calendar-coptic-name calendar-ethiopic-name) |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
229 (calendar-coptic-month-name-array calendar-ethiopic-month-name-array)) |
13053 | 230 (calendar-coptic-date-string date))) |
231 | |
92828
5d415a63a344
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92627
diff
changeset
|
232 ;;;###cal-autoload |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
233 (defun calendar-ethiopic-print-date () |
13053 | 234 "Show the Ethiopic calendar equivalent of the selected date." |
235 (interactive) | |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
236 (let ((calendar-coptic-epoch calendar-ethiopic-epoch) |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
237 (calendar-coptic-name calendar-ethiopic-name) |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
238 (calendar-coptic-month-name-array calendar-ethiopic-month-name-array)) |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
239 (call-interactively 'calendar-coptic-print-date))) |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
240 |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
241 (define-obsolete-function-alias 'calendar-print-ethiopic-date |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
242 'calendar-ethiopic-print-date "23.1") |
13053 | 243 |
92828
5d415a63a344
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92627
diff
changeset
|
244 ;;;###cal-autoload |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
245 (defun calendar-ethiopic-goto-date (date &optional noecho) |
13053 | 246 "Move cursor to Ethiopic date DATE. |
247 Echo Ethiopic date unless NOECHO is t." | |
248 (interactive | |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
249 (let ((calendar-coptic-epoch calendar-ethiopic-epoch) |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
250 (calendar-coptic-name calendar-ethiopic-name) |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
251 (calendar-coptic-month-name-array calendar-ethiopic-month-name-array)) |
93182
6011e8a7280f
(calendar-coptic-read-date): New name for coptic-prompt-for-date.
Glenn Morris <rgm@gnu.org>
parents:
92966
diff
changeset
|
252 (calendar-coptic-read-date))) |
13053 | 253 (calendar-goto-date (calendar-gregorian-from-absolute |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
254 (calendar-ethiopic-to-absolute date))) |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
255 (or noecho (calendar-ethiopic-print-date))) |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
256 |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
257 (define-obsolete-function-alias 'calendar-goto-ethiopic-date |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
258 'calendar-ethiopic-goto-date "23.1") |
13053 | 259 |
93780 | 260 ;; To be called from diary-list-sexp-entries, where DATE is bound. |
92828
5d415a63a344
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92627
diff
changeset
|
261 ;;;###diary-autoload |
13053 | 262 (defun diary-ethiopic-date () |
263 "Ethiopic calendar equivalent of date diary entry." | |
93716
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
264 (let ((calendar-coptic-epoch calendar-ethiopic-epoch) |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
265 (calendar-coptic-name calendar-ethiopic-name) |
144a6495a5a4
(calendar-coptic-month-name-array): Rename coptic-calendar-month-name-array.
Glenn Morris <rgm@gnu.org>
parents:
93638
diff
changeset
|
266 (calendar-coptic-month-name-array calendar-ethiopic-month-name-array)) |
13053 | 267 (diary-coptic-date))) |
268 | |
269 (provide 'cal-coptic) | |
270 | |
92580
2a9b05a547d4
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
79703
diff
changeset
|
271 ;; arch-tag: 72d49161-25df-4072-9312-b182cdca7627 |
13053 | 272 ;;; cal-coptic.el ends here |