Mercurial > emacs
annotate lisp/calendar/cal-bahai.el @ 112382:396b01a20bde
Merge: omit auto-generated aclocal.m4 from repository
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Wed, 19 Jan 2011 21:02:52 -0800 |
parents | ef719132ddfa |
children |
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 |
112218
376148b31b5e
Add 2011 to FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
3 ;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 |
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 |
110015
280c8ae2476d
Add "Package:" file headers to denote built-in packages.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
9 ;; Package: calendar |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
10 |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
11 ;; This file is part of GNU Emacs. |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
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 |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
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. |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
17 |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
18 ;; 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
|
19 ;; 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
|
20 ;; 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
|
21 ;; GNU General Public License for more details. |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
22 |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
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/>. |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
25 |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
26 ;;; Commentary: |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
27 |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
28 ;; This collection of functions implements the features of calendar.el |
95758 | 29 ;; 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
|
30 |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
31 ;; 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
|
32 ;; 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
|
33 ;; "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
|
34 ;; 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
|
35 ;; 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
|
36 ;; 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
|
37 ;; 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
|
38 ;; letter-to-number, reckoning). |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
39 |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
40 ;; 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
|
41 ;; -- 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
|
42 ;; 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
|
43 ;; 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
|
44 ;; which means "all things". |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
45 |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
46 ;; 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
|
47 ;; 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
|
48 ;; 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
|
49 ;; attributes of God. |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
50 |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
51 ;; 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
|
52 ;; 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
|
53 ;; 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
|
54 |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
55 ;;; Code: |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
56 |
93219
c6347f1dc07e
Require calendar, not cal-julian.
Glenn Morris <rgm@gnu.org>
parents:
93181
diff
changeset
|
57 (require 'calendar) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
58 |
82177
f673ee49d36e
(calendar-bahai-month-name-array, calendar-bahai-epoch)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
59 (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
|
60 ["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
|
61 "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
|
62 "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
|
63 "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
|
64 |
82177
f673ee49d36e
(calendar-bahai-month-name-array, calendar-bahai-epoch)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
65 (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
|
66 "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
|
67 |
82177
f673ee49d36e
(calendar-bahai-month-name-array, calendar-bahai-epoch)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
68 (defun calendar-bahai-leap-year-p (year) |
93089 | 69 "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
|
70 (calendar-leap-year-p (+ year 1844))) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
71 |
82177
f673ee49d36e
(calendar-bahai-month-name-array, calendar-bahai-epoch)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
72 (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
|
73 (+ (/ 1844 4) (- (/ 1844 100)) (/ 1844 400)) |
93089 | 74 "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
|
75 Used by `calendar-bahai-to-absolute'.") |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
76 |
93635
9e6a9b87ceb1
(calendar-bahai-to-absolute): Rename calendar-absolute-from-bahai.
Glenn Morris <rgm@gnu.org>
parents:
93631
diff
changeset
|
77 (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
|
78 "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
|
79 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
|
80 Gregorian date Sunday, December 31, 1 BC." |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
81 (let* ((month (calendar-extract-month date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
82 (day (calendar-extract-day date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
83 (year (calendar-extract-year date)) |
92849 | 84 (prior-years (+ (1- year) 1844)) |
85 (leap-days (- (+ (/ prior-years 4) ; leap days in prior years | |
86 (- (/ prior-years 100)) | |
87 (/ prior-years 400)) | |
88 calendar-bahai-leap-base))) | |
89 (+ (1- calendar-bahai-epoch) ; days before epoch | |
90 (* 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
|
91 leap-days |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
92 (calendar-sum m 1 (< m month) 19) |
93089 | 93 (if (= month 19) |
94 (if (calendar-bahai-leap-year-p year) 5 4) | |
95 0) | |
92849 | 96 day))) ; days so far this month |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
97 |
93635
9e6a9b87ceb1
(calendar-bahai-to-absolute): Rename calendar-absolute-from-bahai.
Glenn Morris <rgm@gnu.org>
parents:
93631
diff
changeset
|
98 (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
|
99 '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
|
100 |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
101 (defun calendar-bahai-from-absolute (date) |
93089 | 102 "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
|
103 (if (< date calendar-bahai-epoch) |
92652 | 104 (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
|
105 (let* ((greg (calendar-gregorian-from-absolute date)) |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
106 (gmonth (calendar-extract-month greg)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
107 (year (+ (- (calendar-extract-year greg) 1844) |
93089 | 108 (if (or (> gmonth 3) |
109 (and (= gmonth 3) | |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
110 (>= (calendar-extract-day greg) 21))) |
92849 | 111 1 0))) |
92652 | 112 (month ; search forward from Baha |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
113 (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
|
114 (> 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
|
115 1))) |
92652 | 116 (day ; calculate the day by subtraction |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
117 (- date |
93635
9e6a9b87ceb1
(calendar-bahai-to-absolute): Rename calendar-absolute-from-bahai.
Glenn Morris <rgm@gnu.org>
parents:
93631
diff
changeset
|
118 (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
|
119 (list month day year)))) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
120 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
121 ;;;###cal-autoload |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
122 (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
|
123 "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
|
124 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
|
125 (let* ((bahai-date (calendar-bahai-from-absolute |
92849 | 126 (calendar-absolute-from-gregorian |
127 (or date (calendar-current-date))))) | |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
128 (y (calendar-extract-year bahai-date))) |
93089 | 129 (if (< y 1) |
93456
dc103c655cd1
(calendar-bahai-date-string): Make previous change more explicit.
Glenn Morris <rgm@gnu.org>
parents:
93440
diff
changeset
|
130 "" ; pre-Bahai |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
131 (let* ((m (calendar-extract-month bahai-date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
132 (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
|
133 (monthname (if (and (= m 19) |
dc103c655cd1
(calendar-bahai-date-string): Make previous change more explicit.
Glenn Morris <rgm@gnu.org>
parents:
93440
diff
changeset
|
134 (<= d 0)) |
dc103c655cd1
(calendar-bahai-date-string): Make previous change more explicit.
Glenn Morris <rgm@gnu.org>
parents:
93440
diff
changeset
|
135 "Ayyám-i-Há" |
dc103c655cd1
(calendar-bahai-date-string): Make previous change more explicit.
Glenn Morris <rgm@gnu.org>
parents:
93440
diff
changeset
|
136 (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
|
137 (day (number-to-string |
93456
dc103c655cd1
(calendar-bahai-date-string): Make previous change more explicit.
Glenn Morris <rgm@gnu.org>
parents:
93440
diff
changeset
|
138 (if (<= d 0) |
dc103c655cd1
(calendar-bahai-date-string): Make previous change more explicit.
Glenn Morris <rgm@gnu.org>
parents:
93440
diff
changeset
|
139 (+ 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
|
140 d))) |
93844
bf9ef749c23e
Replace int-to-string with number-to-string.
Glenn Morris <rgm@gnu.org>
parents:
93809
diff
changeset
|
141 (year (number-to-string y)) |
bf9ef749c23e
Replace int-to-string with number-to-string.
Glenn Morris <rgm@gnu.org>
parents:
93809
diff
changeset
|
142 (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
|
143 dayname) |
dc103c655cd1
(calendar-bahai-date-string): Make previous change more explicit.
Glenn Morris <rgm@gnu.org>
parents:
93440
diff
changeset
|
144 ;; 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
|
145 (mapconcat 'eval calendar-date-display-form ""))))) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
146 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
147 ;;;###cal-autoload |
84581
96df62307dfc
(mark-bahai-diary-entries): Fix up typo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82833
diff
changeset
|
148 (defun calendar-bahai-print-date () |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
149 "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
|
150 (interactive) |
93089 | 151 (let ((s (calendar-bahai-date-string (calendar-cursor-to-date t)))) |
152 (if (string-equal s "") | |
153 (message "Date is pre-Bahá'í") | |
154 (message "Bahá'í date: %s" s)))) | |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
155 |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
156 (define-obsolete-function-alias |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
157 '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
|
158 |
93181
42e4c9574956
(calendar-bahai-read-date): New name for
Glenn Morris <rgm@gnu.org>
parents:
93089
diff
changeset
|
159 (defun calendar-bahai-read-date () |
42e4c9574956
(calendar-bahai-read-date): New name for
Glenn Morris <rgm@gnu.org>
parents:
93089
diff
changeset
|
160 "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
|
161 Reads a year, month and day." |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
162 (let* ((today (calendar-current-date)) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
163 (year (calendar-read |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
164 "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
|
165 (lambda (x) (not (zerop x))) |
93844
bf9ef749c23e
Replace int-to-string with number-to-string.
Glenn Morris <rgm@gnu.org>
parents:
93809
diff
changeset
|
166 (number-to-string |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
167 (calendar-extract-year |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
168 (calendar-bahai-from-absolute |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
169 (calendar-absolute-from-gregorian today)))))) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
170 (completion-ignore-case t) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
171 (month (cdr (assoc |
92849 | 172 (completing-read |
173 "Bahá'í calendar month name: " | |
174 (mapcar 'list | |
175 (append calendar-bahai-month-name-array nil)) | |
176 nil t) | |
82177
f673ee49d36e
(calendar-bahai-month-name-array, calendar-bahai-epoch)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
177 (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
|
178 1)))) |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
179 (day (calendar-read "Bahá'í calendar day (1-19): " |
92849 | 180 (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
|
181 (list (list month day year)))) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
182 |
93181
42e4c9574956
(calendar-bahai-read-date): New name for
Glenn Morris <rgm@gnu.org>
parents:
93089
diff
changeset
|
183 (define-obsolete-function-alias |
42e4c9574956
(calendar-bahai-read-date): New name for
Glenn Morris <rgm@gnu.org>
parents:
93089
diff
changeset
|
184 '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
|
185 |
92909
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
186 ;;;###cal-autoload |
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
187 (defun calendar-bahai-goto-date (date &optional noecho) |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
188 "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
|
189 (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
|
190 (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
|
191 (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
|
192 (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
|
193 |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
194 (define-obsolete-function-alias |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
195 '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
|
196 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
197 (defvar displayed-month) |
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
198 (defvar displayed-year) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
199 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
200 ;;;###holiday-autoload |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
201 (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
|
202 "Holiday on MONTH, DAY (Bahá'í) called STRING. |
97403 | 203 If MONTH, DAY (Bahá'í) is visible in the current calendar window, |
204 returns the corresponding Gregorian date in the form of the | |
205 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
|
206 ;; 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
|
207 ;; 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
|
208 ;; 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
|
209 (let* ((bahai-date (calendar-bahai-from-absolute |
92849 | 210 (calendar-absolute-from-gregorian |
211 (list displayed-month 15 displayed-year)))) | |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
212 (m (calendar-extract-month bahai-date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
213 (y (calendar-extract-year bahai-date)) |
93372
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
214 date) |
92911
69683285b129
(holiday-bahai, calendar-bahai-mark-date-pattern): Use unless.
Glenn Morris <rgm@gnu.org>
parents:
92909
diff
changeset
|
215 (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
|
216 ;; 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
|
217 ;; 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
|
218 ;; 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
|
219 ;; 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
|
220 ;; 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
|
221 ;; 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
|
222 ;; 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
|
223 ;; accordingly. |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93796
diff
changeset
|
224 (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
|
225 (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
|
226 (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
|
227 (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
|
228 (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
|
229 (list (list date string)))))) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
230 |
93574 | 231 (autoload 'holiday-fixed "holidays") |
232 | |
233 ;;;###holiday-autoload | |
234 (defun holiday-bahai-new-year () | |
235 "Holiday entry for the Bahá'í New Year, if visible in the calendar window." | |
236 (holiday-fixed 3 21 | |
237 (format "Bahá'í New Year (Naw-Ruz) %d" | |
238 (- displayed-year (1- 1844))))) | |
239 | |
240 ;;;###holiday-autoload | |
241 (defun holiday-bahai-ridvan (&optional all) | |
242 "Holidays related to Ridvan, as visible in the calendar window. | |
243 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
|
244 `calendar-bahai-all-holidays-flag' is non-nil." |
93574 | 245 (let ((ord ["First" "Second" "Third" "Fourth" "Fifth" "Sixth" |
246 "Seventh" "Eighth" "Ninth" "Tenth" "Eleventh" "Twelfth"]) | |
247 (show '(0 8 11)) | |
248 rid h) | |
93631
0dcb238ad128
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93574
diff
changeset
|
249 (if (or all calendar-bahai-all-holidays-flag) |
93574 | 250 (setq show (number-sequence 0 11))) |
251 ;; More trouble than it was worth...? | |
252 (dolist (i show (nreverse rid)) | |
253 (if (setq h (holiday-fixed (if (< i 10) 4 5) | |
254 (+ i (if (< i 10) 21 -9)) | |
255 (format "%s Day of Ridvan" (aref ord i)))) | |
256 (push (car h) rid))))) | |
257 | |
92970
9bc37937216f
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92911
diff
changeset
|
258 (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
|
259 |
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
260 ;;;###diary-autoload |
84581
96df62307dfc
(mark-bahai-diary-entries): Fix up typo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82833
diff
changeset
|
261 (defun diary-bahai-list-entries () |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
262 "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
|
263 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
|
264 \(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
|
265 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
|
266 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
|
267 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
|
268 `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
|
269 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
|
270 `diary-nongregorian-listing-hook'." |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
271 (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
|
272 diary-bahai-entry-symbol |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
273 'calendar-bahai-from-absolute)) |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
274 (define-obsolete-function-alias |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
275 '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
|
276 |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
277 |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
278 (autoload 'calendar-mark-1 "diary-lib") |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
279 |
92909
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
280 ;;;###diary-autoload |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
281 (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
|
282 "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
|
283 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
|
284 passed to `calendar-mark-visible-date' as MARK." |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
285 (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
|
286 'calendar-bahai-to-absolute color)) |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
287 |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
288 (define-obsolete-function-alias |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
289 '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
|
290 |
92909
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
291 |
92970
9bc37937216f
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92911
diff
changeset
|
292 (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
|
293 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
294 ;;;###diary-autoload |
82177
f673ee49d36e
(calendar-bahai-month-name-array, calendar-bahai-epoch)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
295 (defun diary-bahai-mark-entries () |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
296 "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
|
297 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
|
298 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
|
299 (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
|
300 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
|
301 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
|
302 'calendar-bahai-from-absolute)) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
303 |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
304 (define-obsolete-function-alias |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
305 '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
|
306 |
93372
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
307 |
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
308 (autoload 'diary-insert-entry-1 "diary-lib") |
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
309 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
310 ;;;###cal-autoload |
84581
96df62307dfc
(mark-bahai-diary-entries): Fix up typo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82833
diff
changeset
|
311 (defun diary-bahai-insert-entry (arg) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
312 "Insert a diary entry. |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
313 For the Bahá'í date corresponding to the date indicated by point. |
92659 | 314 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
|
315 (interactive "P") |
93372
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
316 (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
|
317 diary-bahai-entry-symbol |
93372
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
318 'calendar-bahai-from-absolute)) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
319 |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
320 (define-obsolete-function-alias |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
321 '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
|
322 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
323 ;;;###cal-autoload |
82177
f673ee49d36e
(calendar-bahai-month-name-array, calendar-bahai-epoch)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
324 (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
|
325 "Insert a monthly diary entry. |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
326 For the day of the Bahá'í month corresponding to the date indicated by point. |
92659 | 327 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
|
328 (interactive "P") |
93372
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
329 (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
|
330 diary-bahai-entry-symbol |
93372
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
331 'calendar-bahai-from-absolute)) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
332 |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
333 (define-obsolete-function-alias |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
334 '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
|
335 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
336 ;;;###cal-autoload |
82177
f673ee49d36e
(calendar-bahai-month-name-array, calendar-bahai-epoch)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
337 (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
|
338 "Insert an annual diary entry. |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
339 For the day of the Bahá'í year corresponding to the date indicated by point. |
92659 | 340 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
|
341 (interactive "P") |
93372
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
342 (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
|
343 diary-bahai-entry-symbol |
93372
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
344 'calendar-bahai-from-absolute)) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
345 |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
346 (define-obsolete-function-alias |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
347 '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
|
348 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
349 (defvar date) |
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
350 |
93796
364b5bfca3a2
Update for diary-lib name changes.
Glenn Morris <rgm@gnu.org>
parents:
93732
diff
changeset
|
351 ;; 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
|
352 ;;;###diary-autoload |
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
353 (defun diary-bahai-date () |
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
354 "Bahá'í calendar equivalent of date diary entry." |
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
355 (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
|
356 |
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
357 |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
358 (provide 'cal-bahai) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
359 |
92578
8b2b620788b7
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
360 ;; Local Variables: |
8b2b620788b7
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
361 ;; coding: utf-8 |
8b2b620788b7
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
362 ;; End: |
8b2b620788b7
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
363 |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
364 ;;; cal-bahai.el ends here |