]> code.delx.au - gnu-emacs/blobdiff - lisp/calendar/cal-bahai.el
(hack-local-variables-confirm) <offer-save>: Clarify message text. Suggested
[gnu-emacs] / lisp / calendar / cal-bahai.el
index 3789bb7abc75312c0713125867591f6d3bfa60ef..f6419cf9a82bf212ca5a3b3972664bc000bbe370 100644 (file)
@@ -1,6 +1,7 @@
 ;;; cal-bahai.el --- calendar functions for the Baha'i calendar.
 
-;; Copyright (C) 2001 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
+;;   Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 ;; Keywords: calendar
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
 ;; This collection of functions implements the features of calendar.el
 ;; and diary.el that deal with the Baha'i calendar.
 
+;; The Baha'i (http://www.bahai.org) calendar system is based on a
+;; solar cycle of 19 months with 19 days each.  The four remaining
+;; "intercalary" days are called the Ayyam-i-Ha (days of Ha), and are
+;; placed between the 18th and 19th months.  They are meant as a time
+;; of festivals preceding the 19th month, which is the month of
+;; fasting.  In Gregorian leap years, there are 5 of these days (Ha
+;; has the numerical value of 5 in the arabic abjad, or
+;; letter-to-number, reckoning).
+
+;; Each month is named after an attribute of God, as are the 19 days
+;; -- which have the same names as the months.  There is also a name
+;; for each year in every 19 year cycle.  These cycles are called
+;; Vahids.  A cycle of 19 Vahids (361 years) is called a Kullu-Shay,
+;; which means "all things".
+
+;; The calendar was named the "Badi calendar" by its author, the Bab.
+;; It uses a week of seven days, corresponding to the Gregorian week,
+;; each of which has its own name, again patterned after the
+;; attributes of God.
+
 ;; Note: The days of Ayyam-i-Ha are encoded as zero and negative
 ;; offsets from the first day of the final month.  So, (19 -3 157) is
 ;; the first day of Ayyam-i-Ha, in the year 157 BE.
 
 ;;; Code:
 
+(defvar date)
+(defvar displayed-month)
+(defvar displayed-year)
+(defvar number)
+(defvar original-date)
+
 (require 'cal-julian)
 
 (defvar bahai-calendar-month-name-array
@@ -195,7 +222,7 @@ calendar.  This function is provided for use with the
             (mark (regexp-quote diary-nonmarking-symbol)))
         (calendar-for-loop i from 1 to number do
            (let* ((d diary-date-forms)
-                  (bdate (calendar-bahai-from-absolute 
+                  (bdate (calendar-bahai-from-absolute
                           (calendar-absolute-from-gregorian gdate)))
                   (month (extract-calendar-month bdate))
                   (day (extract-calendar-day bdate))
@@ -320,13 +347,13 @@ nongregorian-diary-marking-hook."
                       (buffer-substring
                        (match-beginning m-name-pos)
                        (match-end m-name-pos))))
-                 (mm (string-to-int
+                 (mm (string-to-number
                       (if m-pos
                           (buffer-substring
                            (match-beginning m-pos)
                            (match-end m-pos))
                         "")))
-                 (dd (string-to-int
+                 (dd (string-to-number
                       (if d-pos
                           (buffer-substring
                            (match-beginning d-pos)
@@ -345,29 +372,31 @@ nongregorian-diary-marking-hook."
                                     (calendar-bahai-from-absolute
                                      (calendar-absolute-from-gregorian
                                       (calendar-current-date)))))
-                                  (y (+ (string-to-int y-str)
+                                  (y (+ (string-to-number y-str)
                                         (* 100 (/ current-y 100)))))
                              (if (> (- y current-y) 50)
                                  (- y 100)
                                (if (> (- current-y y) 50)
                                    (+ y 100)
                                  y)))
-                         (string-to-int y-str)))))
+                         (string-to-number y-str)))))
             (if dd-name
                 (mark-calendar-days-named
-                 (cdr (assoc-ignore-case (substring dd-name 0 3)
-                                         (calendar-make-alist
-                                          calendar-day-name-array
-                                          0
-                                          '(lambda (x) (substring x 0 3))))))
+                 (cdr (assoc-string (substring dd-name 0 3)
+                                    (calendar-make-alist
+                                     calendar-day-name-array
+                                     0
+                                     '(lambda (x) (substring x 0 3)))
+                                    t)))
               (if mm-name
                   (if (string-equal mm-name "*")
                       (setq mm 0)
                     (setq mm
-                          (cdr (assoc-ignore-case
+                          (cdr (assoc-string
                                 mm-name
                                 (calendar-make-alist
-                                  bahai-calendar-month-name-array))))))
+                                  bahai-calendar-month-name-array)
+                                t)))))
               (mark-bahai-calendar-date-pattern mm dd yy)))))
       (setq d (cdr d)))))
 
@@ -438,7 +467,7 @@ Prefix arg will make the entry nonmarking."
     (make-diary-entry
      (concat
       bahai-diary-entry-symbol
-      (calendar-date-string 
+      (calendar-date-string
        (calendar-bahai-from-absolute
         (calendar-absolute-from-gregorian
          (calendar-cursor-to-date t)))
@@ -456,7 +485,7 @@ Prefix arg will make the entry nonmarking."
     (make-diary-entry
      (concat
       bahai-diary-entry-symbol
-      (calendar-date-string 
+      (calendar-date-string
        (calendar-bahai-from-absolute
         (calendar-absolute-from-gregorian
          (calendar-cursor-to-date t)))))
@@ -475,7 +504,7 @@ Prefix arg will make the entry nonmarking."
     (make-diary-entry
      (concat
       bahai-diary-entry-symbol
-      (calendar-date-string 
+      (calendar-date-string
        (calendar-bahai-from-absolute
         (calendar-absolute-from-gregorian
          (calendar-cursor-to-date t)))))
@@ -483,4 +512,5 @@ Prefix arg will make the entry nonmarking."
 
 (provide 'cal-bahai)
 
+;;; arch-tag: c1cb1d67-862a-4264-a01c-41cb4df01f14
 ;;; cal-bahai.el ends here