aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Wiegley2007-08-23 18:37:08 +0000
committerJohn Wiegley2007-08-23 18:37:08 +0000
commit305c237ca2cae42cf14b1c6dbd57b419b44b1c4b (patch)
tree2f2337a588cd8a5044f8cb49046aad6b08acebd3
parent8274348c795a212fa960b01666ceeb3e4f242a3c (diff)
downloademacs-305c237ca2cae42cf14b1c6dbd57b419b44b1c4b.tar.gz
emacs-305c237ca2cae42cf14b1c6dbd57b419b44b1c4b.zip
2007-08-23 John Wiegley <johnw@newartisans.com>
* calendar/cal-bahai.el: Added in the diacriticals that were missing for many of the month names.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/calendar/cal-bahai.el106
2 files changed, 58 insertions, 53 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index eca6a0895b8..2ed0159ce82 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12007-08-23 John Wiegley <johnw@newartisans.com>
2
3 * calendar/cal-bahai.el: Added in the diacriticals that were
4 missing for many of the month names.
5
12007-08-22 Jason Rumney <jasonr@gnu.org> 62007-08-22 Jason Rumney <jasonr@gnu.org>
2 7
3 * vc-hooks.el (vc-menu-map-filter): Reapply 2007-08-06 bugfix. 8 * vc-hooks.el (vc-menu-map-filter): Reapply 2007-08-06 bugfix.
diff --git a/lisp/calendar/cal-bahai.el b/lisp/calendar/cal-bahai.el
index 1657611466c..80395543c29 100644
--- a/lisp/calendar/cal-bahai.el
+++ b/lisp/calendar/cal-bahai.el
@@ -1,11 +1,11 @@
1;;; cal-bahai.el --- calendar functions for the Baha'i calendar. 1;;; cal-bahai.el --- calendar functions for the Bahá'í calendar.
2 2
3;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 3;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
4;; Free Software Foundation, Inc. 4;; Free Software Foundation, Inc.
5 5
6;; Author: John Wiegley <johnw@gnu.org> 6;; Author: John Wiegley <johnw@gnu.org>
7;; Keywords: calendar 7;; Keywords: calendar
8;; Human-Keywords: Baha'i calendar, Baha'i, Bahai, calendar, diary 8;; Human-Keywords: Bahá'í calendar, Bahá'í, Baha'i, Bahai, calendar, diary
9 9
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11 11
@@ -27,31 +27,31 @@
27;;; Commentary: 27;;; Commentary:
28 28
29;; This collection of functions implements the features of calendar.el 29;; This collection of functions implements the features of calendar.el
30;; and diary.el that deal with the Baha'i calendar. 30;; and diary.el that deal with the Bahá'í calendar.
31 31
32;; The Baha'i (http://www.bahai.org) calendar system is based on a 32;; The Bahá'í (http://www.bahai.org) calendar system is based on a
33;; solar cycle of 19 months with 19 days each. The four remaining 33;; solar cycle of 19 months with 19 days each. The four remaining
34;; "intercalary" days are called the Ayyam-i-Ha (days of Ha), and are 34;; "intercalary" days are called the Ayyám-i-Há (days of Há), and are
35;; placed between the 18th and 19th months. They are meant as a time 35;; placed between the 18th and 19th months. They are meant as a time
36;; of festivals preceding the 19th month, which is the month of 36;; of festivals preceding the 19th month, which is the month of
37;; fasting. In Gregorian leap years, there are 5 of these days (Ha 37;; fasting. In Gregorian leap years, there are 5 of these days (Há
38;; has the numerical value of 5 in the arabic abjad, or 38;; has the numerical value of 5 in the arabic abjad, or
39;; letter-to-number, reckoning). 39;; letter-to-number, reckoning).
40 40
41;; Each month is named after an attribute of God, as are the 19 days 41;; Each month is named after an attribute of God, as are the 19 days
42;; -- which have the same names as the months. There is also a name 42;; -- which have the same names as the months. There is also a name
43;; for each year in every 19 year cycle. These cycles are called 43;; for each year in every 19 year cycle. These cycles are called
44;; Vahids. A cycle of 19 Vahids (361 years) is called a Kullu-Shay, 44;; Váhids. A cycle of 19 Váhids (361 years) is called a Kullu-Shay,
45;; which means "all things". 45;; which means "all things".
46 46
47;; The calendar was named the "Badi calendar" by its author, the Bab. 47;; The calendar was named the "Badí` calendar" by its author, the Báb.
48;; It uses a week of seven days, corresponding to the Gregorian week, 48;; It uses a week of seven days, corresponding to the Gregorian week,
49;; each of which has its own name, again patterned after the 49;; each of which has its own name, again patterned after the
50;; attributes of God. 50;; attributes of God.
51 51
52;; Note: The days of Ayyam-i-Ha are encoded as zero and negative 52;; Note: The days of Ayyám-i-Há are encoded as zero and negative
53;; offsets from the first day of the final month. So, (19 -3 157) is 53;; offsets from the first day of the final month. So, (19 -3 157) is
54;; the first day of Ayyam-i-Ha, in the year 157 BE. 54;; the first day of Ayyám-i-Há, in the year 157 BE.
55 55
56;;; Code: 56;;; Code:
57 57
@@ -64,22 +64,22 @@
64(require 'cal-julian) 64(require 'cal-julian)
65 65
66(defconst calendar-bahai-month-name-array 66(defconst calendar-bahai-month-name-array
67 ["Baha" "Jalal" "Jamal" "`Azamat" "Nur" "Rahmat" "Kalimat" "Kamal" 67 ["Bahá" "Jalál" "Jamál" "`Azamat" "Núr" "Rahmat" "Kalimát" "Kamál"
68 "Asma" "`Izzat" "Mashiyyat" "`Ilm" "Qudrat" "Qawl" "Masa'il" 68 "Asmá" "`Izzat" "Mashiyyat" "`Ilm" "Qudrat" "Qawl" "Masá'il"
69 "Sharaf" "Sultan" "Mulk" "`Ala"]) 69 "Sharaf" "Sultán" "Mulk" "`Alá"])
70 70
71(defconst calendar-bahai-epoch (calendar-absolute-from-gregorian '(3 21 1844)) 71(defconst calendar-bahai-epoch (calendar-absolute-from-gregorian '(3 21 1844))
72 "Absolute date of start of Baha'i calendar = March 19, 622 A.D. (Julian).") 72 "Absolute date of start of Bahá'í calendar = March 19, 622 A.D. (Julian).")
73 73
74(defun calendar-bahai-leap-year-p (year) 74(defun calendar-bahai-leap-year-p (year)
75 "True if YEAR is a leap year on the Baha'i calendar." 75 "True if YEAR is a leap year on the Bahá'í calendar."
76 (calendar-leap-year-p (+ year 1844))) 76 (calendar-leap-year-p (+ year 1844)))
77 77
78(defconst calendar-bahai-leap-base 78(defconst calendar-bahai-leap-base
79 (+ (/ 1844 4) (- (/ 1844 100)) (/ 1844 400))) 79 (+ (/ 1844 4) (- (/ 1844 100)) (/ 1844 400)))
80 80
81(defun calendar-absolute-from-bahai (date) 81(defun calendar-absolute-from-bahai (date)
82 "Compute absolute date from Baha'i date DATE. 82 "Compute absolute date from Bahá'í date DATE.
83The absolute date is the number of days elapsed since the (imaginary) 83The absolute date is the number of days elapsed since the (imaginary)
84Gregorian date Sunday, December 31, 1 BC." 84Gregorian date Sunday, December 31, 1 BC."
85 (let* ((month (extract-calendar-month date)) 85 (let* ((month (extract-calendar-month date))
@@ -98,9 +98,9 @@ Gregorian date Sunday, December 31, 1 BC."
98 day))) ; Days so far this month. 98 day))) ; Days so far this month.
99 99
100(defun calendar-bahai-from-absolute (date) 100(defun calendar-bahai-from-absolute (date)
101 "Baha'i year corresponding to the absolute DATE." 101 "Bahá'í year corresponding to the absolute DATE."
102 (if (< date calendar-bahai-epoch) 102 (if (< date calendar-bahai-epoch)
103 (list 0 0 0) ;; pre-Baha'i date 103 (list 0 0 0) ;; pre-Bahá'í date
104 (let* ((greg (calendar-gregorian-from-absolute date)) 104 (let* ((greg (calendar-gregorian-from-absolute date))
105 (year (+ (- (extract-calendar-year greg) 1844) 105 (year (+ (- (extract-calendar-year greg) 1844)
106 (if (or (> (extract-calendar-month greg) 3) 106 (if (or (> (extract-calendar-month greg) 3)
@@ -119,7 +119,7 @@ Gregorian date Sunday, December 31, 1 BC."
119 (list month day year)))) 119 (list month day year))))
120 120
121(defun calendar-bahai-date-string (&optional date) 121(defun calendar-bahai-date-string (&optional date)
122 "String of Baha'i date of Gregorian DATE. 122 "String of Bahá'í date of Gregorian DATE.
123Defaults to today's date if DATE is not given." 123Defaults to today's date if DATE is not given."
124 (let* ((bahai-date (calendar-bahai-from-absolute 124 (let* ((bahai-date (calendar-bahai-from-absolute
125 (calendar-absolute-from-gregorian 125 (calendar-absolute-from-gregorian
@@ -130,7 +130,7 @@ Defaults to today's date if DATE is not given."
130 (let ((monthname 130 (let ((monthname
131 (if (and (= m 19) 131 (if (and (= m 19)
132 (<= d 0)) 132 (<= d 0))
133 "Ayyam-i-Ha" 133 "Ayyám-i-Há"
134 (aref calendar-bahai-month-name-array (1- m)))) 134 (aref calendar-bahai-month-name-array (1- m))))
135 (day (int-to-string 135 (day (int-to-string
136 (if (<= d 0) 136 (if (<= d 0)
@@ -144,24 +144,24 @@ Defaults to today's date if DATE is not given."
144 (mapconcat 'eval calendar-date-display-form "")))) 144 (mapconcat 'eval calendar-date-display-form ""))))
145 145
146(defun calendar-print-bahai-date () 146(defun calendar-print-bahai-date ()
147 "Show the Baha'i calendar equivalent of the selected date." 147 "Show the Bahá'í calendar equivalent of the selected date."
148 (interactive) 148 (interactive)
149 (message "Baha'i date: %s" 149 (message "Bahá'í date: %s"
150 (calendar-bahai-date-string (calendar-cursor-to-date t)))) 150 (calendar-bahai-date-string (calendar-cursor-to-date t))))
151 151
152(defun calendar-goto-bahai-date (date &optional noecho) 152(defun calendar-goto-bahai-date (date &optional noecho)
153 "Move cursor to Baha'i date DATE. 153 "Move cursor to Bahá'í date DATE.
154Echo Baha'i date unless NOECHO is t." 154Echo Bahá'í date unless NOECHO is t."
155 (interactive (calendar-bahai-prompt-for-date)) 155 (interactive (calendar-bahai-prompt-for-date))
156 (calendar-goto-date (calendar-gregorian-from-absolute 156 (calendar-goto-date (calendar-gregorian-from-absolute
157 (calendar-absolute-from-bahai date))) 157 (calendar-absolute-from-bahai date)))
158 (or noecho (calendar-print-bahai-date))) 158 (or noecho (calendar-print-bahai-date)))
159 159
160(defun calendar-bahai-prompt-for-date () 160(defun calendar-bahai-prompt-for-date ()
161 "Ask for a Baha'i date." 161 "Ask for a Bahá'í date."
162 (let* ((today (calendar-current-date)) 162 (let* ((today (calendar-current-date))
163 (year (calendar-read 163 (year (calendar-read
164 "Baha'i calendar year (not 0): " 164 "Bahá'í calendar year (not 0): "
165 '(lambda (x) (/= x 0)) 165 '(lambda (x) (/= x 0))
166 (int-to-string 166 (int-to-string
167 (extract-calendar-year 167 (extract-calendar-year
@@ -170,23 +170,23 @@ Echo Baha'i date unless NOECHO is t."
170 (completion-ignore-case t) 170 (completion-ignore-case t)
171 (month (cdr (assoc 171 (month (cdr (assoc
172 (completing-read 172 (completing-read
173 "Baha'i calendar month name: " 173 "Bahá'í calendar month name: "
174 (mapcar 'list 174 (mapcar 'list
175 (append calendar-bahai-month-name-array nil)) 175 (append calendar-bahai-month-name-array nil))
176 nil t) 176 nil t)
177 (calendar-make-alist calendar-bahai-month-name-array 177 (calendar-make-alist calendar-bahai-month-name-array
178 1)))) 178 1))))
179 (day (calendar-read "Baha'i calendar day (1-19): " 179 (day (calendar-read "Bahá'í calendar day (1-19): "
180 '(lambda (x) (and (< 0 x) (<= x 19)))))) 180 '(lambda (x) (and (< 0 x) (<= x 19))))))
181 (list (list month day year)))) 181 (list (list month day year))))
182 182
183(defun diary-bahai-date () 183(defun diary-bahai-date ()
184 "Baha'i calendar equivalent of date diary entry." 184 "Bahá'í calendar equivalent of date diary entry."
185 (format "Baha'i date: %s" (calendar-bahai-date-string date))) 185 (format "Bahá'í date: %s" (calendar-bahai-date-string date)))
186 186
187(defun holiday-bahai (month day string) 187(defun holiday-bahai (month day string)
188 "Holiday on MONTH, DAY (Baha'i) called STRING. 188 "Holiday on MONTH, DAY (Bahá'í) called STRING.
189If MONTH, DAY (Baha'i) is visible, the value returned is corresponding 189If MONTH, DAY (Bahá'í) is visible, the value returned is corresponding
190Gregorian date in the form of the list (((month day year) STRING)). Returns 190Gregorian date in the form of the list (((month day year) STRING)). Returns
191nil if it is not visible in the current calendar window." 191nil if it is not visible in the current calendar window."
192 (let* ((bahai-date (calendar-bahai-from-absolute 192 (let* ((bahai-date (calendar-bahai-from-absolute
@@ -196,22 +196,22 @@ nil if it is not visible in the current calendar window."
196 (y (extract-calendar-year bahai-date)) 196 (y (extract-calendar-year bahai-date))
197 (date)) 197 (date))
198 (if (< m 1) 198 (if (< m 1)
199 nil ;; Baha'i calendar doesn't apply. 199 nil ;; Bahá'í calendar doesn't apply.
200 (increment-calendar-month m y (- 10 month)) 200 (increment-calendar-month m y (- 10 month))
201 (if (> m 7) ;; Baha'i date might be visible 201 (if (> m 7) ;; Bahá'í date might be visible
202 (let ((date (calendar-gregorian-from-absolute 202 (let ((date (calendar-gregorian-from-absolute
203 (calendar-absolute-from-bahai (list month day y))))) 203 (calendar-absolute-from-bahai (list month day y)))))
204 (if (calendar-date-is-visible-p date) 204 (if (calendar-date-is-visible-p date)
205 (list (list date string)))))))) 205 (list (list date string))))))))
206 206
207(defun diary-list-bahai-entries () 207(defun diary-list-bahai-entries ()
208 "Add any Baha'i date entries from the diary file to `diary-entries-list'. 208 "Add any Bahá'í date entries from the diary file to `diary-entries-list'.
209Baha'i date diary entries must be prefaced by an 209Bahá'í date diary entries must be prefaced by an
210`bahai-diary-entry-symbol' (normally a `B'). The same diary date 210`bahai-diary-entry-symbol' (normally a `B'). The same diary date
211forms govern the style of the Baha'i calendar entries, except that the 211forms govern the style of the Bahá'í calendar entries, except that the
212Baha'i month names must be given numerically. The Baha'i months are 212Bahá'í month names must be given numerically. The Bahá'í months are
213numbered from 1 to 19 with Baha being 1 and 19 being `Ala. If a 213numbered from 1 to 19 with Bahá being 1 and 19 being `Alá. If a
214Baha'i date diary entry begins with a `diary-nonmarking-symbol', the 214Bahá'í date diary entry begins with a `diary-nonmarking-symbol', the
215entry will appear in the diary listing, but will not be marked in the 215entry will appear in the diary listing, but will not be marked in the
216calendar. This function is provided for use with the 216calendar. This function is provided for use with the
217`nongregorian-diary-listing-hook'." 217`nongregorian-diary-listing-hook'."
@@ -291,14 +291,14 @@ calendar. This function is provided for use with the
291 (goto-char (point-min)))) 291 (goto-char (point-min))))
292 292
293(defun diary-bahai-mark-entries () 293(defun diary-bahai-mark-entries ()
294 "Mark days in the calendar window that have Baha'i date diary entries. 294 "Mark days in the calendar window that have Bahá'í date diary entries.
295Each entry in diary-file (or included files) visible in the calendar 295Each entry in diary-file (or included files) visible in the calendar
296window is marked. Baha'i date entries are prefaced by a 296window is marked. Bahá'í date entries are prefaced by a
297bahai-diary-entry-symbol \(normally a B`I'). The same 297bahai-diary-entry-symbol \(normally a B`I'). The same
298diary-date-forms govern the style of the Baha'i calendar entries, 298diary-date-forms govern the style of the Bahá'í calendar entries,
299except that the Baha'i month names must be spelled in full. The 299except that the Bahá'í month names must be spelled in full. The
300Baha'i months are numbered from 1 to 12 with Baha being 1 and 12 being 300Bahá'í months are numbered from 1 to 12 with Bahá being 1 and 12 being
301`Ala. Baha'i date diary entries that begin with a 301`Alá. Bahá'í date diary entries that begin with a
302diary-nonmarking-symbol will not be marked in the calendar. This 302diary-nonmarking-symbol will not be marked in the calendar. This
303function is provided for use as part of the 303function is provided for use as part of the
304nongregorian-diary-marking-hook." 304nongregorian-diary-marking-hook."
@@ -401,13 +401,13 @@ nongregorian-diary-marking-hook."
401 (setq d (cdr d))))) 401 (setq d (cdr d)))))
402 402
403(defun calendar-bahai-mark-date-pattern (month day year) 403(defun calendar-bahai-mark-date-pattern (month day year)
404 "Mark dates in calendar window that conform to Baha'i date MONTH/DAY/YEAR. 404 "Mark dates in calendar window that conform to Bahá'í date MONTH/DAY/YEAR.
405A value of 0 in any position is a wildcard." 405A value of 0 in any position is a wildcard."
406 (save-excursion 406 (save-excursion
407 (set-buffer calendar-buffer) 407 (set-buffer calendar-buffer)
408 (if (and (/= 0 month) (/= 0 day)) 408 (if (and (/= 0 month) (/= 0 day))
409 (if (/= 0 year) 409 (if (/= 0 year)
410 ;; Fully specified Baha'i date. 410 ;; Fully specified Bahá'í date.
411 (let ((date (calendar-gregorian-from-absolute 411 (let ((date (calendar-gregorian-from-absolute
412 (calendar-absolute-from-bahai 412 (calendar-absolute-from-bahai
413 (list month day year))))) 413 (list month day year)))))
@@ -421,9 +421,9 @@ A value of 0 in any position is a wildcard."
421 (y (extract-calendar-year bahai-date)) 421 (y (extract-calendar-year bahai-date))
422 (date)) 422 (date))
423 (if (< m 1) 423 (if (< m 1)
424 nil;; Baha'i calendar doesn't apply. 424 nil;; Bahá'í calendar doesn't apply.
425 (increment-calendar-month m y (- 10 month)) 425 (increment-calendar-month m y (- 10 month))
426 (if (> m 7);; Baha'i date might be visible 426 (if (> m 7);; Bahá'í date might be visible
427 (let ((date (calendar-gregorian-from-absolute 427 (let ((date (calendar-gregorian-from-absolute
428 (calendar-absolute-from-bahai 428 (calendar-absolute-from-bahai
429 (list month day y))))) 429 (list month day y)))))
@@ -460,7 +460,7 @@ A value of 0 in any position is a wildcard."
460 460
461(defun diary-insert-bahai-entry (arg) 461(defun diary-insert-bahai-entry (arg)
462 "Insert a diary entry. 462 "Insert a diary entry.
463For the Baha'i date corresponding to the date indicated by point. 463For the Bahá'í date corresponding to the date indicated by point.
464Prefix arg will make the entry nonmarking." 464Prefix arg will make the entry nonmarking."
465 (interactive "P") 465 (interactive "P")
466 (let* ((calendar-month-name-array calendar-bahai-month-name-array)) 466 (let* ((calendar-month-name-array calendar-bahai-month-name-array))
@@ -476,7 +476,7 @@ Prefix arg will make the entry nonmarking."
476 476
477(defun diary-bahai-insert-monthly-entry (arg) 477(defun diary-bahai-insert-monthly-entry (arg)
478 "Insert a monthly diary entry. 478 "Insert a monthly diary entry.
479For the day of the Baha'i month corresponding to the date indicated by point. 479For the day of the Bahá'í month corresponding to the date indicated by point.
480Prefix arg will make the entry nonmarking." 480Prefix arg will make the entry nonmarking."
481 (interactive "P") 481 (interactive "P")
482 (let* ((calendar-date-display-form 482 (let* ((calendar-date-display-form
@@ -493,7 +493,7 @@ Prefix arg will make the entry nonmarking."
493 493
494(defun diary-bahai-insert-yearly-entry (arg) 494(defun diary-bahai-insert-yearly-entry (arg)
495 "Insert an annual diary entry. 495 "Insert an annual diary entry.
496For the day of the Baha'i year corresponding to the date indicated by point. 496For the day of the Bahá'í year corresponding to the date indicated by point.
497Prefix arg will make the entry nonmarking." 497Prefix arg will make the entry nonmarking."
498 (interactive "P") 498 (interactive "P")
499 (let* ((calendar-date-display-form 499 (let* ((calendar-date-display-form