Mercurial > emacs
annotate lisp/calendar/cal-bahai.el @ 111376:21858bb1a2e7
Fix bug #7285.
ls-lisp.el (insert-directory): Doc fix.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sat, 06 Nov 2010 11:57:24 +0200 |
parents | 1d1d5d9bd884 |
children | 280c8ae2476d 376148b31b5e |
rev | line source |
---|---|
92578
8b2b620788b7
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
1 ;;; cal-bahai.el --- calendar functions for the Bahá'í calendar. |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
2 |
106815 | 3 ;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 |
68721 | 4 ;; Free Software Foundation, Inc. |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
5 |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
6 ;; Author: John Wiegley <johnw@gnu.org> |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
7 ;; Keywords: calendar |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
8 ;; Human-Keywords: Bahá'í calendar, Bahá'í, Baha'i, Bahai, calendar, diary |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
9 |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
10 ;; This file is part of GNU Emacs. |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
11 |
94653
e49abd957e81
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93844
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
13 ;; 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
|
14 ;; 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
|
15 ;; (at your option) any later version. |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
16 |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
17 ;; GNU Emacs is distributed in the hope that it will be useful, |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
20 ;; GNU General Public License for more details. |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
21 |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
22 ;; 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
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
24 |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
25 ;;; Commentary: |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
26 |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
27 ;; This collection of functions implements the features of calendar.el |
95758 | 28 ;; and diary-lib.el that deal with the Bahá'í calendar. |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
29 |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
30 ;; The Bahá'í (http://www.bahai.org) calendar system is based on a |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
31 ;; solar cycle of 19 months with 19 days each. The four remaining |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
32 ;; "intercalary" days are called the Ayyám-i-Há (days of Há), and are |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
33 ;; placed between the 18th and 19th months. They are meant as a time |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
34 ;; of festivals preceding the 19th month, which is the month of |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
35 ;; fasting. In Gregorian leap years, there are 5 of these days (Há |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
36 ;; has the numerical value of 5 in the arabic abjad, or |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
37 ;; letter-to-number, reckoning). |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
38 |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
39 ;; Each month is named after an attribute of God, as are the 19 days |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
40 ;; -- which have the same names as the months. There is also a name |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
41 ;; for each year in every 19 year cycle. These cycles are called |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
42 ;; Váhids. A cycle of 19 Váhids (361 years) is called a Kullu-Shay, |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
43 ;; which means "all things". |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
44 |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
45 ;; The calendar was named the "Badí` calendar" by its author, the Báb. |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
46 ;; It uses a week of seven days, corresponding to the Gregorian week, |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
47 ;; each of which has its own name, again patterned after the |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
48 ;; attributes of God. |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
49 |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
50 ;; Note: The days of Ayyám-i-Há are encoded as zero and negative |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
51 ;; offsets from the first day of the final month. So, (19 -3 157) is |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
52 ;; the first day of Ayyám-i-Há, in the year 157 BE. |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
53 |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
54 ;;; Code: |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
55 |
93219
c6347f1dc07e
Require calendar, not cal-julian.
Glenn Morris <rgm@gnu.org>
parents:
93181
diff
changeset
|
56 (require 'calendar) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
57 |
82177
f673ee49d36e
(calendar-bahai-month-name-array, calendar-bahai-epoch)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
58 (defconst calendar-bahai-month-name-array |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
59 ["Bahá" "Jalál" "Jamál" "`Azamat" "Núr" "Rahmat" "Kalimát" "Kamál" |
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
60 "Asmá" "`Izzat" "Mashiyyat" "`Ilm" "Qudrat" "Qawl" "Masá'il" |
92909
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
61 "Sharaf" "Sultán" "Mulk" "`Alá"] |
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
62 "Array of the month names in the Bahá'í calendar.") |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
63 |
82177
f673ee49d36e
(calendar-bahai-month-name-array, calendar-bahai-epoch)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
64 (defconst calendar-bahai-epoch (calendar-absolute-from-gregorian '(3 21 1844)) |
93219
c6347f1dc07e
Require calendar, not cal-julian.
Glenn Morris <rgm@gnu.org>
parents:
93181
diff
changeset
|
65 "Absolute date of start of Bahá'í calendar = March 21, 1844 AD.") |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
66 |
82177
f673ee49d36e
(calendar-bahai-month-name-array, calendar-bahai-epoch)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
67 (defun calendar-bahai-leap-year-p (year) |
93089 | 68 "True if Bahá'í YEAR is a leap year in the Bahá'í calendar." |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
69 (calendar-leap-year-p (+ year 1844))) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
70 |
82177
f673ee49d36e
(calendar-bahai-month-name-array, calendar-bahai-epoch)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
71 (defconst calendar-bahai-leap-base |
92909
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
72 (+ (/ 1844 4) (- (/ 1844 100)) (/ 1844 400)) |
93089 | 73 "Number of leap years between 1 and 1844 AD, inclusive. |
93635
9e6a9b87ceb1
(calendar-bahai-to-absolute): Rename calendar-absolute-from-bahai.
Glenn Morris <rgm@gnu.org>
parents:
93631
diff
changeset
|
74 Used by `calendar-bahai-to-absolute'.") |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
75 |
93635
9e6a9b87ceb1
(calendar-bahai-to-absolute): Rename calendar-absolute-from-bahai.
Glenn Morris <rgm@gnu.org>
parents:
93631
diff
changeset
|
76 (defun calendar-bahai-to-absolute (date) |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
77 "Compute absolute date from Bahá'í date DATE. |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
78 The absolute date is the number of days elapsed since the (imaginary) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
79 Gregorian date Sunday, December 31, 1 BC." |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
80 (let* ((month (calendar-extract-month date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
81 (day (calendar-extract-day date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
82 (year (calendar-extract-year date)) |
92849 | 83 (prior-years (+ (1- year) 1844)) |
84 (leap-days (- (+ (/ prior-years 4) ; leap days in prior years | |
85 (- (/ prior-years 100)) | |
86 (/ prior-years 400)) | |
87 calendar-bahai-leap-base))) | |
88 (+ (1- calendar-bahai-epoch) ; days before epoch | |
89 (* 365 (1- year)) ; days in prior years | |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
90 leap-days |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
91 (calendar-sum m 1 (< m month) 19) |
93089 | 92 (if (= month 19) |
93 (if (calendar-bahai-leap-year-p year) 5 4) | |
94 0) | |
92849 | 95 day))) ; days so far this month |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
96 |
93635
9e6a9b87ceb1
(calendar-bahai-to-absolute): Rename calendar-absolute-from-bahai.
Glenn Morris <rgm@gnu.org>
parents:
93631
diff
changeset
|
97 (define-obsolete-function-alias 'calendar-absolute-from-bahai |
9e6a9b87ceb1
(calendar-bahai-to-absolute): Rename calendar-absolute-from-bahai.
Glenn Morris <rgm@gnu.org>
parents:
93631
diff
changeset
|
98 'calendar-bahai-to-absolute "23.1") |
9e6a9b87ceb1
(calendar-bahai-to-absolute): Rename calendar-absolute-from-bahai.
Glenn Morris <rgm@gnu.org>
parents:
93631
diff
changeset
|
99 |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
100 (defun calendar-bahai-from-absolute (date) |
93089 | 101 "Bahá'í date (month day year) corresponding to the absolute DATE." |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
102 (if (< date calendar-bahai-epoch) |
92652 | 103 (list 0 0 0) ; pre-Bahá'í date |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
104 (let* ((greg (calendar-gregorian-from-absolute date)) |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
105 (gmonth (calendar-extract-month greg)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
106 (year (+ (- (calendar-extract-year greg) 1844) |
93089 | 107 (if (or (> gmonth 3) |
108 (and (= gmonth 3) | |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
109 (>= (calendar-extract-day greg) 21))) |
92849 | 110 1 0))) |
92652 | 111 (month ; search forward from Baha |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
112 (1+ (calendar-sum m 1 |
93635
9e6a9b87ceb1
(calendar-bahai-to-absolute): Rename calendar-absolute-from-bahai.
Glenn Morris <rgm@gnu.org>
parents:
93631
diff
changeset
|
113 (> date (calendar-bahai-to-absolute (list m 19 year))) |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
114 1))) |
92652 | 115 (day ; calculate the day by subtraction |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
116 (- date |
93635
9e6a9b87ceb1
(calendar-bahai-to-absolute): Rename calendar-absolute-from-bahai.
Glenn Morris <rgm@gnu.org>
parents:
93631
diff
changeset
|
117 (1- (calendar-bahai-to-absolute (list month 1 year)))))) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
118 (list month day year)))) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
119 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
120 ;;;###cal-autoload |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
121 (defun calendar-bahai-date-string (&optional date) |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
122 "String of Bahá'í date of Gregorian DATE. |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
123 Defaults to today's date if DATE is not given." |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
124 (let* ((bahai-date (calendar-bahai-from-absolute |
92849 | 125 (calendar-absolute-from-gregorian |
126 (or date (calendar-current-date))))) | |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
127 (y (calendar-extract-year bahai-date))) |
93089 | 128 (if (< y 1) |
93456
dc103c655cd1
(calendar-bahai-date-string): Make previous change more explicit.
Glenn Morris <rgm@gnu.org>
parents:
93440
diff
changeset
|
129 "" ; pre-Bahai |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
130 (let* ((m (calendar-extract-month bahai-date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
131 (d (calendar-extract-day bahai-date)) |
93456
dc103c655cd1
(calendar-bahai-date-string): Make previous change more explicit.
Glenn Morris <rgm@gnu.org>
parents:
93440
diff
changeset
|
132 (monthname (if (and (= m 19) |
dc103c655cd1
(calendar-bahai-date-string): Make previous change more explicit.
Glenn Morris <rgm@gnu.org>
parents:
93440
diff
changeset
|
133 (<= d 0)) |
dc103c655cd1
(calendar-bahai-date-string): Make previous change more explicit.
Glenn Morris <rgm@gnu.org>
parents:
93440
diff
changeset
|
134 "Ayyám-i-Há" |
dc103c655cd1
(calendar-bahai-date-string): Make previous change more explicit.
Glenn Morris <rgm@gnu.org>
parents:
93440
diff
changeset
|
135 (aref calendar-bahai-month-name-array (1- m)))) |
93844
bf9ef749c23e
Replace int-to-string with number-to-string.
Glenn Morris <rgm@gnu.org>
parents:
93809
diff
changeset
|
136 (day (number-to-string |
93456
dc103c655cd1
(calendar-bahai-date-string): Make previous change more explicit.
Glenn Morris <rgm@gnu.org>
parents:
93440
diff
changeset
|
137 (if (<= d 0) |
dc103c655cd1
(calendar-bahai-date-string): Make previous change more explicit.
Glenn Morris <rgm@gnu.org>
parents:
93440
diff
changeset
|
138 (+ d (if (calendar-bahai-leap-year-p y) 5 4)) |
dc103c655cd1
(calendar-bahai-date-string): Make previous change more explicit.
Glenn Morris <rgm@gnu.org>
parents:
93440
diff
changeset
|
139 d))) |
93844
bf9ef749c23e
Replace int-to-string with number-to-string.
Glenn Morris <rgm@gnu.org>
parents:
93809
diff
changeset
|
140 (year (number-to-string y)) |
bf9ef749c23e
Replace int-to-string with number-to-string.
Glenn Morris <rgm@gnu.org>
parents:
93809
diff
changeset
|
141 (month (number-to-string m)) |
93456
dc103c655cd1
(calendar-bahai-date-string): Make previous change more explicit.
Glenn Morris <rgm@gnu.org>
parents:
93440
diff
changeset
|
142 dayname) |
dc103c655cd1
(calendar-bahai-date-string): Make previous change more explicit.
Glenn Morris <rgm@gnu.org>
parents:
93440
diff
changeset
|
143 ;; Can't call calendar-date-string because of monthname oddity. |
dc103c655cd1
(calendar-bahai-date-string): Make previous change more explicit.
Glenn Morris <rgm@gnu.org>
parents:
93440
diff
changeset
|
144 (mapconcat 'eval calendar-date-display-form ""))))) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
145 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
146 ;;;###cal-autoload |
84581
96df62307dfc
(mark-bahai-diary-entries): Fix up typo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82833
diff
changeset
|
147 (defun calendar-bahai-print-date () |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
148 "Show the Bahá'í calendar equivalent of the selected date." |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
149 (interactive) |
93089 | 150 (let ((s (calendar-bahai-date-string (calendar-cursor-to-date t)))) |
151 (if (string-equal s "") | |
152 (message "Date is pre-Bahá'í") | |
153 (message "Bahá'í date: %s" s)))) | |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
154 |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
155 (define-obsolete-function-alias |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
156 'calendar-print-bahai-date 'calendar-bahai-print-date "23.1") |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
157 |
93181
42e4c9574956
(calendar-bahai-read-date): New name for
Glenn Morris <rgm@gnu.org>
parents:
93089
diff
changeset
|
158 (defun calendar-bahai-read-date () |
42e4c9574956
(calendar-bahai-read-date): New name for
Glenn Morris <rgm@gnu.org>
parents:
93089
diff
changeset
|
159 "Interactively read the arguments for a Bahá'í date command. |
42e4c9574956
(calendar-bahai-read-date): New name for
Glenn Morris <rgm@gnu.org>
parents:
93089
diff
changeset
|
160 Reads a year, month and day." |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
161 (let* ((today (calendar-current-date)) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
162 (year (calendar-read |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
163 "Bahá'í calendar year (not 0): " |
92615
3dd341aae76d
(calendar-bahai-prompt-for-date, calendar-bahai-mark-date-pattern):
Glenn Morris <rgm@gnu.org>
parents:
92578
diff
changeset
|
164 (lambda (x) (not (zerop x))) |
93844
bf9ef749c23e
Replace int-to-string with number-to-string.
Glenn Morris <rgm@gnu.org>
parents:
93809
diff
changeset
|
165 (number-to-string |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
166 (calendar-extract-year |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
167 (calendar-bahai-from-absolute |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
168 (calendar-absolute-from-gregorian today)))))) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
169 (completion-ignore-case t) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
170 (month (cdr (assoc |
92849 | 171 (completing-read |
172 "Bahá'í calendar month name: " | |
173 (mapcar 'list | |
174 (append calendar-bahai-month-name-array nil)) | |
175 nil t) | |
82177
f673ee49d36e
(calendar-bahai-month-name-array, calendar-bahai-epoch)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
176 (calendar-make-alist calendar-bahai-month-name-array |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
177 1)))) |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
178 (day (calendar-read "Bahá'í calendar day (1-19): " |
92849 | 179 (lambda (x) (and (< 0 x) (<= x 19)))))) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
180 (list (list month day year)))) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
181 |
93181
42e4c9574956
(calendar-bahai-read-date): New name for
Glenn Morris <rgm@gnu.org>
parents:
93089
diff
changeset
|
182 (define-obsolete-function-alias |
42e4c9574956
(calendar-bahai-read-date): New name for
Glenn Morris <rgm@gnu.org>
parents:
93089
diff
changeset
|
183 'calendar-bahai-prompt-for-date 'calendar-bahai-read-date "23.1") |
42e4c9574956
(calendar-bahai-read-date): New name for
Glenn Morris <rgm@gnu.org>
parents:
93089
diff
changeset
|
184 |
92909
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
185 ;;;###cal-autoload |
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
186 (defun calendar-bahai-goto-date (date &optional noecho) |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
187 "Move cursor to Bahá'í date DATE; echo Bahá'í date unless NOECHO is non-nil." |
93181
42e4c9574956
(calendar-bahai-read-date): New name for
Glenn Morris <rgm@gnu.org>
parents:
93089
diff
changeset
|
188 (interactive (calendar-bahai-read-date)) |
92909
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
189 (calendar-goto-date (calendar-gregorian-from-absolute |
93635
9e6a9b87ceb1
(calendar-bahai-to-absolute): Rename calendar-absolute-from-bahai.
Glenn Morris <rgm@gnu.org>
parents:
93631
diff
changeset
|
190 (calendar-bahai-to-absolute date))) |
92909
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
191 (or noecho (calendar-bahai-print-date))) |
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
192 |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
193 (define-obsolete-function-alias |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
194 'calendar-goto-bahai-date 'calendar-bahai-goto-date "23.1") |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
195 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
196 (defvar displayed-month) |
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
197 (defvar displayed-year) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
198 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
199 ;;;###holiday-autoload |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
200 (defun holiday-bahai (month day string) |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
201 "Holiday on MONTH, DAY (Bahá'í) called STRING. |
97403 | 202 If MONTH, DAY (Bahá'í) is visible in the current calendar window, |
203 returns the corresponding Gregorian date in the form of the | |
204 list (((month day year) STRING)). Otherwise, returns nil." | |
93467
bbc3ec766bc4
(holiday-bahai): Use an algorithm actually relevant to this calendar
Glenn Morris <rgm@gnu.org>
parents:
93456
diff
changeset
|
205 ;; Since the calendar window shows 3 months at a time, there are |
bbc3ec766bc4
(holiday-bahai): Use an algorithm actually relevant to this calendar
Glenn Morris <rgm@gnu.org>
parents:
93456
diff
changeset
|
206 ;; approx +/- 45 days either side of the central month. |
bbc3ec766bc4
(holiday-bahai): Use an algorithm actually relevant to this calendar
Glenn Morris <rgm@gnu.org>
parents:
93456
diff
changeset
|
207 ;; Since the Bahai months have 19 days, this means up to +/- 3 months. |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
208 (let* ((bahai-date (calendar-bahai-from-absolute |
92849 | 209 (calendar-absolute-from-gregorian |
210 (list displayed-month 15 displayed-year)))) | |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
211 (m (calendar-extract-month bahai-date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
212 (y (calendar-extract-year bahai-date)) |
93372
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
213 date) |
92911
69683285b129
(holiday-bahai, calendar-bahai-mark-date-pattern): Use unless.
Glenn Morris <rgm@gnu.org>
parents:
92909
diff
changeset
|
214 (unless (< m 1) ; Bahá'í calendar doesn't apply |
93467
bbc3ec766bc4
(holiday-bahai): Use an algorithm actually relevant to this calendar
Glenn Morris <rgm@gnu.org>
parents:
93456
diff
changeset
|
215 ;; Cf holiday-fixed, holiday-islamic. |
bbc3ec766bc4
(holiday-bahai): Use an algorithm actually relevant to this calendar
Glenn Morris <rgm@gnu.org>
parents:
93456
diff
changeset
|
216 ;; With a +- 3 month calendar window, and 19 months per year, |
bbc3ec766bc4
(holiday-bahai): Use an algorithm actually relevant to this calendar
Glenn Morris <rgm@gnu.org>
parents:
93456
diff
changeset
|
217 ;; month 16 is special. When m16 is central is when the |
bbc3ec766bc4
(holiday-bahai): Use an algorithm actually relevant to this calendar
Glenn Morris <rgm@gnu.org>
parents:
93456
diff
changeset
|
218 ;; end-of-year first appears. When m1 is central, m16 is no |
bbc3ec766bc4
(holiday-bahai): Use an algorithm actually relevant to this calendar
Glenn Morris <rgm@gnu.org>
parents:
93456
diff
changeset
|
219 ;; longer visible. Hence we can do a one-sided test to see if |
bbc3ec766bc4
(holiday-bahai): Use an algorithm actually relevant to this calendar
Glenn Morris <rgm@gnu.org>
parents:
93456
diff
changeset
|
220 ;; m16 is visible. m16 is visible when the central month >= 13. |
bbc3ec766bc4
(holiday-bahai): Use an algorithm actually relevant to this calendar
Glenn Morris <rgm@gnu.org>
parents:
93456
diff
changeset
|
221 ;; To see if other months are visible we can shift the range |
bbc3ec766bc4
(holiday-bahai): Use an algorithm actually relevant to this calendar
Glenn Morris <rgm@gnu.org>
parents:
93456
diff
changeset
|
222 ;; accordingly. |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
223 (calendar-increment-month m y (- 16 month) 19) |
93467
bbc3ec766bc4
(holiday-bahai): Use an algorithm actually relevant to this calendar
Glenn Morris <rgm@gnu.org>
parents:
93456
diff
changeset
|
224 (and (> m 12) ; Bahá'í date might be visible |
bbc3ec766bc4
(holiday-bahai): Use an algorithm actually relevant to this calendar
Glenn Morris <rgm@gnu.org>
parents:
93456
diff
changeset
|
225 (calendar-date-is-visible-p |
bbc3ec766bc4
(holiday-bahai): Use an algorithm actually relevant to this calendar
Glenn Morris <rgm@gnu.org>
parents:
93456
diff
changeset
|
226 (setq date (calendar-gregorian-from-absolute |
93635
9e6a9b87ceb1
(calendar-bahai-to-absolute): Rename calendar-absolute-from-bahai.
Glenn Morris <rgm@gnu.org>
parents:
93631
diff
changeset
|
227 (calendar-bahai-to-absolute (list month day y))))) |
93467
bbc3ec766bc4
(holiday-bahai): Use an algorithm actually relevant to this calendar
Glenn Morris <rgm@gnu.org>
parents:
93456
diff
changeset
|
228 (list (list date string)))))) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
229 |
93574 | 230 (autoload 'holiday-fixed "holidays") |
231 | |
232 ;;;###holiday-autoload | |
233 (defun holiday-bahai-new-year () | |
234 "Holiday entry for the Bahá'í New Year, if visible in the calendar window." | |
235 (holiday-fixed 3 21 | |
236 (format "Bahá'í New Year (Naw-Ruz) %d" | |
237 (- displayed-year (1- 1844))))) | |
238 | |
239 ;;;###holiday-autoload | |
240 (defun holiday-bahai-ridvan (&optional all) | |
241 "Holidays related to Ridvan, as visible in the calendar window. | |
242 Only considers the first, ninth, and twelfth days, unless ALL or | |
93631
0dcb238ad128
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93574
diff
changeset
|
243 `calendar-bahai-all-holidays-flag' is non-nil." |
93574 | 244 (let ((ord ["First" "Second" "Third" "Fourth" "Fifth" "Sixth" |
245 "Seventh" "Eighth" "Ninth" "Tenth" "Eleventh" "Twelfth"]) | |
246 (show '(0 8 11)) | |
247 rid h) | |
93631
0dcb238ad128
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93574
diff
changeset
|
248 (if (or all calendar-bahai-all-holidays-flag) |
93574 | 249 (setq show (number-sequence 0 11))) |
250 ;; More trouble than it was worth...? | |
251 (dolist (i show (nreverse rid)) | |
252 (if (setq h (holiday-fixed (if (< i 10) 4 5) | |
253 (+ i (if (< i 10) 21 -9)) | |
254 (format "%s Day of Ridvan" (aref ord i)))) | |
255 (push (car h) rid))))) | |
256 | |
92970
9bc37937216f
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92911
diff
changeset
|
257 (autoload 'diary-list-entries-1 "diary-lib") |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
258 |
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
259 ;;;###diary-autoload |
84581
96df62307dfc
(mark-bahai-diary-entries): Fix up typo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82833
diff
changeset
|
260 (defun diary-bahai-list-entries () |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
261 "Add any Bahá'í date entries from the diary file to `diary-entries-list'. |
93732
87dc3cf28f80
Update for rename bahai-diary-entry-symbol to diary-bahai-entry-symbol.
Glenn Morris <rgm@gnu.org>
parents:
93635
diff
changeset
|
262 Bahá'í date diary entries must be prefaced by `diary-bahai-entry-symbol' |
92909
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
263 \(normally a `B'). The same diary date forms govern the style of the |
93267
9425e236c79d
(diary-bahai-list-entries): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
93219
diff
changeset
|
264 Bahá'í calendar entries, except that the Bahá'í month names cannot be |
9425e236c79d
(diary-bahai-list-entries): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
93219
diff
changeset
|
265 abbreviated. The Bahá'í months are numbered from 1 to 19 with Bahá being |
92909
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
266 1 and 19 being `Alá. If a Bahá'í date diary entry begins with |
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
267 `diary-nonmarking-symbol', the entry will appear in the diary listing, but |
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
268 will not be marked in the calendar. This function is provided for use with |
93796
364b5bfca3a2
Update for diary-lib name changes.
Glenn Morris <rgm@gnu.org>
parents:
93732
diff
changeset
|
269 `diary-nongregorian-listing-hook'." |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
270 (diary-list-entries-1 calendar-bahai-month-name-array |
93732
87dc3cf28f80
Update for rename bahai-diary-entry-symbol to diary-bahai-entry-symbol.
Glenn Morris <rgm@gnu.org>
parents:
93635
diff
changeset
|
271 diary-bahai-entry-symbol |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
272 'calendar-bahai-from-absolute)) |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
273 (define-obsolete-function-alias |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
274 'list-bahai-diary-entries 'diary-bahai-list-entries "23.1") |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
275 |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
276 |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
277 (autoload 'calendar-mark-1 "diary-lib") |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
278 |
92909
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
279 ;;;###diary-autoload |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
280 (defun calendar-bahai-mark-date-pattern (month day year &optional color) |
92909
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
281 "Mark dates in calendar window that conform to Bahá'í date MONTH/DAY/YEAR. |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
282 A value of 0 in any position is a wildcard. Optional argument COLOR is |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
283 passed to `calendar-mark-visible-date' as MARK." |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
284 (calendar-mark-1 month day year 'calendar-bahai-from-absolute |
93635
9e6a9b87ceb1
(calendar-bahai-to-absolute): Rename calendar-absolute-from-bahai.
Glenn Morris <rgm@gnu.org>
parents:
93631
diff
changeset
|
285 'calendar-bahai-to-absolute color)) |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
286 |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
287 (define-obsolete-function-alias |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
288 'mark-bahai-calendar-date-pattern 'calendar-bahai-mark-date-pattern "23.1") |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
289 |
92909
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
290 |
92970
9bc37937216f
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92911
diff
changeset
|
291 (autoload 'diary-mark-entries-1 "diary-lib") |
86488
41a473ff321a
(add-to-diary-list, diary-name-pattern)
Glenn Morris <rgm@gnu.org>
parents:
84590
diff
changeset
|
292 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
293 ;;;###diary-autoload |
82177
f673ee49d36e
(calendar-bahai-month-name-array, calendar-bahai-epoch)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
294 (defun diary-bahai-mark-entries () |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
295 "Mark days in the calendar window that have Bahá'í date diary entries. |
92970
9bc37937216f
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92911
diff
changeset
|
296 Marks each entry in `diary-file' (or included files) visible in the calendar |
9bc37937216f
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92911
diff
changeset
|
297 window. See `diary-bahai-list-entries' for more information." |
93470
2b5b4299a020
(diary-bahai-mark-entries): Fix argument order in call to diary-mark-entries-1.
Glenn Morris <rgm@gnu.org>
parents:
93467
diff
changeset
|
298 (diary-mark-entries-1 'calendar-bahai-mark-date-pattern |
2b5b4299a020
(diary-bahai-mark-entries): Fix argument order in call to diary-mark-entries-1.
Glenn Morris <rgm@gnu.org>
parents:
93467
diff
changeset
|
299 calendar-bahai-month-name-array |
93732
87dc3cf28f80
Update for rename bahai-diary-entry-symbol to diary-bahai-entry-symbol.
Glenn Morris <rgm@gnu.org>
parents:
93635
diff
changeset
|
300 diary-bahai-entry-symbol |
93470
2b5b4299a020
(diary-bahai-mark-entries): Fix argument order in call to diary-mark-entries-1.
Glenn Morris <rgm@gnu.org>
parents:
93467
diff
changeset
|
301 'calendar-bahai-from-absolute)) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
302 |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
303 (define-obsolete-function-alias |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
304 'mark-bahai-diary-entries 'diary-bahai-mark-entries "23.1") |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
305 |
93372
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
306 |
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
307 (autoload 'diary-insert-entry-1 "diary-lib") |
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
308 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
309 ;;;###cal-autoload |
84581
96df62307dfc
(mark-bahai-diary-entries): Fix up typo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82833
diff
changeset
|
310 (defun diary-bahai-insert-entry (arg) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
311 "Insert a diary entry. |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
312 For the Bahá'í date corresponding to the date indicated by point. |
92659 | 313 Prefix argument ARG makes the entry nonmarking." |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
314 (interactive "P") |
93372
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
315 (diary-insert-entry-1 nil arg calendar-bahai-month-name-array |
93732
87dc3cf28f80
Update for rename bahai-diary-entry-symbol to diary-bahai-entry-symbol.
Glenn Morris <rgm@gnu.org>
parents:
93635
diff
changeset
|
316 diary-bahai-entry-symbol |
93372
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
317 'calendar-bahai-from-absolute)) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
318 |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
319 (define-obsolete-function-alias |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
320 'insert-bahai-diary-entry 'diary-bahai-insert-entry "23.1") |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
321 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
322 ;;;###cal-autoload |
82177
f673ee49d36e
(calendar-bahai-month-name-array, calendar-bahai-epoch)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
323 (defun diary-bahai-insert-monthly-entry (arg) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
324 "Insert a monthly diary entry. |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
325 For the day of the Bahá'í month corresponding to the date indicated by point. |
92659 | 326 Prefix argument ARG makes the entry nonmarking." |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
327 (interactive "P") |
93372
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
328 (diary-insert-entry-1 'monthly arg calendar-bahai-month-name-array |
93732
87dc3cf28f80
Update for rename bahai-diary-entry-symbol to diary-bahai-entry-symbol.
Glenn Morris <rgm@gnu.org>
parents:
93635
diff
changeset
|
329 diary-bahai-entry-symbol |
93372
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
330 'calendar-bahai-from-absolute)) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
331 |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
332 (define-obsolete-function-alias |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
333 'insert-monthly-bahai-diary-entry 'diary-bahai-insert-monthly-entry "23.1") |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
334 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
335 ;;;###cal-autoload |
82177
f673ee49d36e
(calendar-bahai-month-name-array, calendar-bahai-epoch)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
336 (defun diary-bahai-insert-yearly-entry (arg) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
337 "Insert an annual diary entry. |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
338 For the day of the Bahá'í year corresponding to the date indicated by point. |
92659 | 339 Prefix argument ARG will make the entry nonmarking." |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
340 (interactive "P") |
93372
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
341 (diary-insert-entry-1 'yearly arg calendar-bahai-month-name-array |
93732
87dc3cf28f80
Update for rename bahai-diary-entry-symbol to diary-bahai-entry-symbol.
Glenn Morris <rgm@gnu.org>
parents:
93635
diff
changeset
|
342 diary-bahai-entry-symbol |
93372
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
343 'calendar-bahai-from-absolute)) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
344 |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
345 (define-obsolete-function-alias |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
346 'insert-yearly-bahai-diary-entry 'diary-bahai-insert-yearly-entry "23.1") |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
347 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
348 (defvar date) |
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
349 |
93796
364b5bfca3a2
Update for diary-lib name changes.
Glenn Morris <rgm@gnu.org>
parents:
93732
diff
changeset
|
350 ;; To be called from diary-list-sexp-entries, where DATE is bound. |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
351 ;;;###diary-autoload |
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
352 (defun diary-bahai-date () |
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
353 "Bahá'í calendar equivalent of date diary entry." |
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
354 (format "Bahá'í date: %s" (calendar-bahai-date-string date))) |
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
355 |
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
356 |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
357 (provide 'cal-bahai) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
358 |
92578
8b2b620788b7
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
359 ;; Local Variables: |
8b2b620788b7
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
360 ;; coding: utf-8 |
8b2b620788b7
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
361 ;; End: |
8b2b620788b7
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
362 |
82177
f673ee49d36e
(calendar-bahai-month-name-array, calendar-bahai-epoch)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
363 ;; arch-tag: c1cb1d67-862a-4264-a01c-41cb4df01f14 |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
364 ;;; cal-bahai.el ends here |