Mercurial > emacs
annotate lisp/calendar/cal-bahai.el @ 93384:dc87cb6ec6a6
*** empty log message ***
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sat, 29 Mar 2008 13:53:02 +0000 |
parents | ed15c3f99e18 |
children | 6181940a6360 |
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 |
79703 | 3 ;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 |
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 |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
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 |
78216
93e11478c954
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
78143
diff
changeset
|
14 ;; the Free Software Foundation; either version 3, or (at your option) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
15 ;; any later version. |
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 |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64085 | 24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 ;; Boston, MA 02110-1301, USA. | |
55431
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 ;;; Commentary: |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
28 |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
29 ;; This collection of functions implements the features of calendar.el |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
30 ;; and diary.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
|
31 |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
32 ;; 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
|
33 ;; 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
|
34 ;; "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
|
35 ;; 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
|
36 ;; 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
|
37 ;; 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
|
38 ;; 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
|
39 ;; letter-to-number, reckoning). |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
40 |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
41 ;; 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
|
42 ;; -- 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
|
43 ;; 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
|
44 ;; 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
|
45 ;; which means "all things". |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
46 |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
47 ;; 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
|
48 ;; 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
|
49 ;; 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
|
50 ;; attributes of God. |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
51 |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
52 ;; 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
|
53 ;; 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
|
54 ;; 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
|
55 |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
56 ;;; Code: |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
57 |
93219
c6347f1dc07e
Require calendar, not cal-julian.
Glenn Morris <rgm@gnu.org>
parents:
93181
diff
changeset
|
58 (require 'calendar) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
59 |
82177
f673ee49d36e
(calendar-bahai-month-name-array, calendar-bahai-epoch)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
60 (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
|
61 ["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
|
62 "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
|
63 "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
|
64 "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
|
65 |
82177
f673ee49d36e
(calendar-bahai-month-name-array, calendar-bahai-epoch)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
66 (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
|
67 "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
|
68 |
82177
f673ee49d36e
(calendar-bahai-month-name-array, calendar-bahai-epoch)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
69 (defun calendar-bahai-leap-year-p (year) |
93089 | 70 "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
|
71 (calendar-leap-year-p (+ year 1844))) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
72 |
82177
f673ee49d36e
(calendar-bahai-month-name-array, calendar-bahai-epoch)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
73 (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
|
74 (+ (/ 1844 4) (- (/ 1844 100)) (/ 1844 400)) |
93089 | 75 "Number of leap years between 1 and 1844 AD, inclusive. |
76 Used by `calendar-absolute-from-bahai'.") | |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
77 |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
78 (defun calendar-absolute-from-bahai (date) |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
79 "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
|
80 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
|
81 Gregorian date Sunday, December 31, 1 BC." |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
82 (let* ((month (extract-calendar-month date)) |
92849 | 83 (day (extract-calendar-day date)) |
84 (year (extract-calendar-year date)) | |
85 (prior-years (+ (1- year) 1844)) | |
86 (leap-days (- (+ (/ prior-years 4) ; leap days in prior years | |
87 (- (/ prior-years 100)) | |
88 (/ prior-years 400)) | |
89 calendar-bahai-leap-base))) | |
90 (+ (1- calendar-bahai-epoch) ; days before epoch | |
91 (* 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
|
92 leap-days |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
93 (calendar-sum m 1 (< m month) 19) |
93089 | 94 (if (= month 19) |
95 (if (calendar-bahai-leap-year-p year) 5 4) | |
96 0) | |
92849 | 97 day))) ; days so far this month |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
98 |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
99 (defun calendar-bahai-from-absolute (date) |
93089 | 100 "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
|
101 (if (< date calendar-bahai-epoch) |
92652 | 102 (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
|
103 (let* ((greg (calendar-gregorian-from-absolute date)) |
93089 | 104 (gmonth (extract-calendar-month greg)) |
92849 | 105 (year (+ (- (extract-calendar-year greg) 1844) |
93089 | 106 (if (or (> gmonth 3) |
107 (and (= gmonth 3) | |
92849 | 108 (>= (extract-calendar-day greg) 21))) |
109 1 0))) | |
92652 | 110 (month ; search forward from Baha |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
111 (1+ (calendar-sum m 1 |
93089 | 112 (> date (calendar-absolute-from-bahai (list m 19 year))) |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
113 1))) |
92652 | 114 (day ; calculate the day by subtraction |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
115 (- date |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
116 (1- (calendar-absolute-from-bahai (list month 1 year)))))) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
117 (list month day year)))) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
118 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
119 ;;;###cal-autoload |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
120 (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
|
121 "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
|
122 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
|
123 (let* ((bahai-date (calendar-bahai-from-absolute |
92849 | 124 (calendar-absolute-from-gregorian |
125 (or date (calendar-current-date))))) | |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
126 (y (extract-calendar-year bahai-date)) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
127 (m (extract-calendar-month bahai-date)) |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
128 (d (extract-calendar-day bahai-date)) |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
129 (monthname (if (and (= m 19) |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
130 (<= d 0)) |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
131 "Ayyám-i-Há" |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
132 (aref calendar-bahai-month-name-array (1- m)))) |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
133 (day (int-to-string |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
134 (if (<= d 0) |
93089 | 135 (+ d (if (calendar-bahai-leap-year-p y) 5 4)) |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
136 d))) |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
137 (year (int-to-string y)) |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
138 (month (int-to-string m)) |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
139 dayname) |
93089 | 140 (if (< y 1) |
141 "" | |
142 ;; Can't call calendar-date-string because of monthname oddity. | |
143 (mapconcat 'eval calendar-date-display-form "")))) | |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
144 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
145 ;;;###cal-autoload |
84581
96df62307dfc
(mark-bahai-diary-entries): Fix up typo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82833
diff
changeset
|
146 (defun calendar-bahai-print-date () |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
147 "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
|
148 (interactive) |
93089 | 149 (let ((s (calendar-bahai-date-string (calendar-cursor-to-date t)))) |
150 (if (string-equal s "") | |
151 (message "Date is pre-Bahá'í") | |
152 (message "Bahá'í date: %s" s)))) | |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
153 |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
154 (define-obsolete-function-alias |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
155 '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
|
156 |
93181
42e4c9574956
(calendar-bahai-read-date): New name for
Glenn Morris <rgm@gnu.org>
parents:
93089
diff
changeset
|
157 (defun calendar-bahai-read-date () |
42e4c9574956
(calendar-bahai-read-date): New name for
Glenn Morris <rgm@gnu.org>
parents:
93089
diff
changeset
|
158 "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
|
159 Reads a year, month and day." |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
160 (let* ((today (calendar-current-date)) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
161 (year (calendar-read |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
162 "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
|
163 (lambda (x) (not (zerop x))) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
164 (int-to-string |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
165 (extract-calendar-year |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
166 (calendar-bahai-from-absolute |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
167 (calendar-absolute-from-gregorian today)))))) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
168 (completion-ignore-case t) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
169 (month (cdr (assoc |
92849 | 170 (completing-read |
171 "Bahá'í calendar month name: " | |
172 (mapcar 'list | |
173 (append calendar-bahai-month-name-array nil)) | |
174 nil t) | |
82177
f673ee49d36e
(calendar-bahai-month-name-array, calendar-bahai-epoch)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
175 (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
|
176 1)))) |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
177 (day (calendar-read "Bahá'í calendar day (1-19): " |
92849 | 178 (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
|
179 (list (list month day year)))) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
180 |
93181
42e4c9574956
(calendar-bahai-read-date): New name for
Glenn Morris <rgm@gnu.org>
parents:
93089
diff
changeset
|
181 (define-obsolete-function-alias |
42e4c9574956
(calendar-bahai-read-date): New name for
Glenn Morris <rgm@gnu.org>
parents:
93089
diff
changeset
|
182 '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
|
183 |
92909
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
184 ;;;###cal-autoload |
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
185 (defun calendar-bahai-goto-date (date &optional noecho) |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
186 "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
|
187 (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
|
188 (calendar-goto-date (calendar-gregorian-from-absolute |
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
189 (calendar-absolute-from-bahai date))) |
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
190 (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
|
191 |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
192 (define-obsolete-function-alias |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
193 '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
|
194 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
195 (defvar displayed-month) |
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
196 (defvar displayed-year) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
197 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
198 ;;;###holiday-autoload |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
199 (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
|
200 "Holiday on MONTH, DAY (Bahá'í) called STRING. |
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
201 If MONTH, DAY (Bahá'í) is visible, the value returned is corresponding |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
202 Gregorian date in the form of the list (((month day year) STRING)). Returns |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
203 nil if it is not visible in the current calendar window." |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
204 (let* ((bahai-date (calendar-bahai-from-absolute |
92849 | 205 (calendar-absolute-from-gregorian |
206 (list displayed-month 15 displayed-year)))) | |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
207 (m (extract-calendar-month bahai-date)) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
208 (y (extract-calendar-year bahai-date)) |
93372
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
209 date) |
92911
69683285b129
(holiday-bahai, calendar-bahai-mark-date-pattern): Use unless.
Glenn Morris <rgm@gnu.org>
parents:
92909
diff
changeset
|
210 (unless (< m 1) ; Bahá'í calendar doesn't apply |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
211 (increment-calendar-month m y (- 10 month)) |
92849 | 212 (if (> m 7) ; Bahá'í date might be visible |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
213 (let ((date (calendar-gregorian-from-absolute |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
214 (calendar-absolute-from-bahai (list month day y))))) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
215 (if (calendar-date-is-visible-p date) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
216 (list (list date string)))))))) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
217 |
92970
9bc37937216f
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92911
diff
changeset
|
218 (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
|
219 |
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
220 ;;;###diary-autoload |
84581
96df62307dfc
(mark-bahai-diary-entries): Fix up typo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82833
diff
changeset
|
221 (defun diary-bahai-list-entries () |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
222 "Add any Bahá'í date entries from the diary file to `diary-entries-list'. |
92909
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
223 Bahá'í date diary entries must be prefaced by `bahai-diary-entry-symbol' |
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
224 \(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
|
225 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
|
226 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
|
227 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
|
228 `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
|
229 will not be marked in the calendar. This function is provided for use with |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
230 `nongregorian-diary-listing-hook'." |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
231 (diary-list-entries-1 calendar-bahai-month-name-array |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
232 bahai-diary-entry-symbol |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
233 'calendar-bahai-from-absolute)) |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
234 (define-obsolete-function-alias |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
235 '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
|
236 |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
237 |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
238 (autoload 'calendar-mark-1 "diary-lib") |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
239 |
92909
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
240 ;;;###diary-autoload |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
241 (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
|
242 "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
|
243 A value of 0 in any position is a wildcard. Optional argument COLOR is |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
244 passed to `mark-visible-calendar-date' as MARK." |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
245 (calendar-mark-1 month day year 'calendar-bahai-from-absolute |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
246 'calendar-absolute-from-bahai color)) |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
247 |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
248 (define-obsolete-function-alias |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
249 '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
|
250 |
92909
e6b06f524f2b
(calendar-bahai-month-name-array, calendar-bahai-leap-base): Add doc strings.
Glenn Morris <rgm@gnu.org>
parents:
92849
diff
changeset
|
251 |
92970
9bc37937216f
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92911
diff
changeset
|
252 (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
|
253 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
254 ;;;###diary-autoload |
82177
f673ee49d36e
(calendar-bahai-month-name-array, calendar-bahai-epoch)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
255 (defun diary-bahai-mark-entries () |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
256 "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
|
257 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
|
258 window. See `diary-bahai-list-entries' for more information." |
9bc37937216f
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92911
diff
changeset
|
259 (diary-mark-entries-1 calendar-bahai-month-name-array |
9bc37937216f
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92911
diff
changeset
|
260 bahai-diary-entry-symbol |
9bc37937216f
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92911
diff
changeset
|
261 'calendar-bahai-from-absolute |
9bc37937216f
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92911
diff
changeset
|
262 'calendar-bahai-mark-date-pattern)) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
263 |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
264 (define-obsolete-function-alias |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
265 '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
|
266 |
93372
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
267 |
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
268 (autoload 'diary-insert-entry-1 "diary-lib") |
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
269 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
270 ;;;###cal-autoload |
84581
96df62307dfc
(mark-bahai-diary-entries): Fix up typo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82833
diff
changeset
|
271 (defun diary-bahai-insert-entry (arg) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
272 "Insert a diary entry. |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
273 For the Bahá'í date corresponding to the date indicated by point. |
92659 | 274 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
|
275 (interactive "P") |
93372
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
276 (diary-insert-entry-1 nil arg calendar-bahai-month-name-array |
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
277 bahai-diary-entry-symbol |
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
278 'calendar-bahai-from-absolute)) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
279 |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
280 (define-obsolete-function-alias |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
281 '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
|
282 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
283 ;;;###cal-autoload |
82177
f673ee49d36e
(calendar-bahai-month-name-array, calendar-bahai-epoch)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
284 (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
|
285 "Insert a monthly diary entry. |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
286 For the day of the Bahá'í month corresponding to the date indicated by point. |
92659 | 287 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
|
288 (interactive "P") |
93372
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
289 (diary-insert-entry-1 'monthly arg calendar-bahai-month-name-array |
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
290 bahai-diary-entry-symbol |
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
291 'calendar-bahai-from-absolute)) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
292 |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
293 (define-obsolete-function-alias |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
294 '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
|
295 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
296 ;;;###cal-autoload |
82177
f673ee49d36e
(calendar-bahai-month-name-array, calendar-bahai-epoch)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
297 (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
|
298 "Insert an annual diary entry. |
82787
03ac28e9a566
2007-08-23 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
82177
diff
changeset
|
299 For the day of the Bahá'í year corresponding to the date indicated by point. |
92659 | 300 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
|
301 (interactive "P") |
93372
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
302 (diary-insert-entry-1 'yearly arg calendar-bahai-month-name-array |
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
303 bahai-diary-entry-symbol |
ed15c3f99e18
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93267
diff
changeset
|
304 'calendar-bahai-from-absolute)) |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
305 |
92990
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
306 (define-obsolete-function-alias |
2d634b2258fb
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92970
diff
changeset
|
307 '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
|
308 |
92826
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
309 (defvar date) |
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
310 |
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
311 ;; To be called from list-sexp-diary-entries, where DATE is bound. |
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
312 ;;;###diary-autoload |
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
313 (defun diary-bahai-date () |
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
314 "Bahá'í calendar equivalent of date diary entry." |
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
315 (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
|
316 |
416592e7d882
Move variable declarations where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92659
diff
changeset
|
317 |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
318 (provide 'cal-bahai) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
diff
changeset
|
319 |
92578
8b2b620788b7
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
320 ;; Local Variables: |
8b2b620788b7
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
321 ;; coding: utf-8 |
8b2b620788b7
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
322 ;; End: |
8b2b620788b7
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
323 |
82177
f673ee49d36e
(calendar-bahai-month-name-array, calendar-bahai-epoch)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
324 ;; 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
|
325 ;;; cal-bahai.el ends here |