annotate lisp/calendar/cal-islam.el @ 93642:d01118f40990

Update for cal-julian name changes. (calendar-islamic-leap-year-p): Rename islamic-calendar-leap-year-p. Update callers. (calendar-islamic-last-day-of-month): Rename islamic-calendar-last-day-of-month. Update callers. (calendar-islamic-day-number): Rename islamic-calendar-day-number. Update callers. (calendar-islamic-to-absolute): Rename calendar-absolute-from-islamic. Update callers, keep old name as alias. (calendar-islamic-print-date): Rename calendar-print-islamic-date. Update callers, keep old name as alias. (calendar-islamic-goto-date): Rename calendar-goto-islamic-date. Keep old name as alias. (diary-islamic-list-entries): Rename list-islamic-diary-entries. Update callers, keep old name as alias. (calendar-islamic-mark-date-pattern): Rename mark-islamic-calendar-date-pattern. Update callers, keep old name as alias. (diary-islamic-insert-entry): Rename insert-islamic-diary-entry. Keep old name as alias. (diary-islamic-insert-monthly-entry): Rename insert-monthly-islamic-diary-entry. Keep old name as alias. (diary-islamic-insert-yearly-entry): Rename insert-yearly-islamic-diary-entry. Keep old name as alias.
author Glenn Morris <rgm@gnu.org>
date Fri, 04 Apr 2008 07:12:12 +0000
parents bac2b63b476f
children e1a9003feedf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38422
7a94f1c588c4 Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38402
diff changeset
1 ;;; cal-islam.el --- calendar functions for the Islamic calendar
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
2
92610
6f4bd17c2adc (mark-islamic-calendar-date-pattern): Use zerop.
Glenn Morris <rgm@gnu.org>
parents: 92585
diff changeset
3 ;; Copyright (C) 1995, 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
6f4bd17c2adc (mark-islamic-calendar-date-pattern): Use zerop.
Glenn Morris <rgm@gnu.org>
parents: 92585
diff changeset
4 ;; 2008 Free Software Foundation, Inc.
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
5
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
6 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
67465
a55ee709ec8d Update copyright pending Emacs 22.
Glenn Morris <rgm@gnu.org>
parents: 65144
diff changeset
7 ;; Maintainer: Glenn Morris <rgm@gnu.org>
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
8 ;; Keywords: calendar
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
9 ;; Human-Keywords: Islamic calendar, calendar, diary
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
10
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
11 ;; This file is part of GNU Emacs.
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
12
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
13 ;; GNU Emacs is free software; you can redistribute it and/or modify
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
14 ;; 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: 77279
diff changeset
15 ;; the Free Software Foundation; either version 3, or (at your option)
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
16 ;; any later version.
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
17
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
18 ;; GNU Emacs is distributed in the hope that it will be useful,
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
21 ;; GNU General Public License for more details.
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
22
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13053
diff changeset
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64085
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 62402
diff changeset
25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 62402
diff changeset
26 ;; Boston, MA 02110-1301, USA.
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
27
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
28 ;;; Commentary:
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
29
93462
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
30 ;; See calendar.el.
20462
d179de7ad92e Add reference to new Calendrical Calculations book.
Paul Eggert <eggert@twinsun.com>
parents: 20268
diff changeset
31
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
32 ;;; Code:
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
33
93223
9aca848375df Require calendar rather than cal-julian.
Glenn Morris <rgm@gnu.org>
parents: 93184
diff changeset
34 (require 'calendar)
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
35
92971
56c7e60586c9 (number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents: 92926
diff changeset
36 (defconst calendar-islamic-month-name-array
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
37 ["Muharram" "Safar" "Rabi I" "Rabi II" "Jumada I" "Jumada II"
52119
226327fe046f (displayed-month, displayed-year): Define for compiler.
Glenn Morris <rgm@gnu.org>
parents: 49598
diff changeset
38 "Rajab" "Sha'ban" "Ramadan" "Shawwal" "Dhu al-Qada" "Dhu al-Hijjah"]
226327fe046f (displayed-month, displayed-year): Define for compiler.
Glenn Morris <rgm@gnu.org>
parents: 49598
diff changeset
39 "Array of strings giving the names of the Islamic months.")
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
40
93223
9aca848375df Require calendar rather than cal-julian.
Glenn Morris <rgm@gnu.org>
parents: 93184
diff changeset
41 (eval-and-compile
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
42 (autoload 'calendar-julian-to-absolute "cal-julian"))
93223
9aca848375df Require calendar rather than cal-julian.
Glenn Morris <rgm@gnu.org>
parents: 93184
diff changeset
43
9aca848375df Require calendar rather than cal-julian.
Glenn Morris <rgm@gnu.org>
parents: 93184
diff changeset
44 (defconst calendar-islamic-epoch
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
45 (eval-when-compile (calendar-julian-to-absolute '(7 16 622)))
93223
9aca848375df Require calendar rather than cal-julian.
Glenn Morris <rgm@gnu.org>
parents: 93184
diff changeset
46 "Absolute date of start of Islamic calendar = July 16, 622 AD (Julian).")
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
47
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
48 (defun calendar-islamic-leap-year-p (year)
92645
611e312d3f05 (islamic-calendar-leap-year-p)
Glenn Morris <rgm@gnu.org>
parents: 92644
diff changeset
49 "Return t if YEAR is a leap year on the Islamic calendar."
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
50 (memq (% year 30)
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
51 (list 2 5 7 10 13 16 18 21 24 26 29)))
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
52
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
53 (defun calendar-islamic-last-day-of-month (month year)
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
54 "The last day in MONTH during YEAR on the Islamic calendar."
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
55 (cond
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
56 ((memq month (list 1 3 5 7 9 11)) 30)
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
57 ((memq month (list 2 4 6 8 10)) 29)
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
58 (t (if (calendar-islamic-leap-year-p year) 30 29))))
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
59
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
60 (defun calendar-islamic-day-number (date)
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
61 "Return the day number within the year of the Islamic date DATE."
92926
b87a8e95883b (displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents: 92832
diff changeset
62 (let ((month (extract-calendar-month date)))
b87a8e95883b (displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents: 92832
diff changeset
63 (+ (* 30 (/ month 2))
b87a8e95883b (displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents: 92832
diff changeset
64 (* 29 (/ (1- month) 2))
b87a8e95883b (displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents: 92832
diff changeset
65 (extract-calendar-day date))))
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
66
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
67 (defun calendar-islamic-to-absolute (date)
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
68 "Absolute date of Islamic DATE.
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
69 The absolute date is the number of days elapsed since the (imaginary)
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
70 Gregorian date Sunday, December 31, 1 BC."
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
71 (let* ((month (extract-calendar-month date))
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
72 (day (extract-calendar-day date))
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
73 (year (extract-calendar-year date))
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
74 (y (% year 30))
92991
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
75 (leap-years-in-cycle (cond ((< y 3) 0)
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
76 ((< y 6) 1)
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
77 ((< y 8) 2)
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
78 ((< y 11) 3)
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
79 ((< y 14) 4)
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
80 ((< y 17) 5)
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
81 ((< y 19) 6)
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
82 ((< y 22) 7)
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
83 ((< y 25) 8)
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
84 ((< y 27) 9)
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
85 (t 10))))
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
86 (+ (calendar-islamic-day-number date) ; days so far this year
92644
df2219fdc233 Formatting changes only.
Glenn Morris <rgm@gnu.org>
parents: 92610
diff changeset
87 (* (1- year) 354) ; days in all non-leap years
df2219fdc233 Formatting changes only.
Glenn Morris <rgm@gnu.org>
parents: 92610
diff changeset
88 (* 11 (/ year 30)) ; leap days in complete cycles
df2219fdc233 Formatting changes only.
Glenn Morris <rgm@gnu.org>
parents: 92610
diff changeset
89 leap-years-in-cycle ; leap days this cycle
df2219fdc233 Formatting changes only.
Glenn Morris <rgm@gnu.org>
parents: 92610
diff changeset
90 (1- calendar-islamic-epoch)))) ; days before start of calendar
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
91
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
92 (define-obsolete-function-alias 'calendar-absolute-from-islamic
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
93 'calendar-islamic-to-absolute "23.1")
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
94
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
95 (defun calendar-islamic-from-absolute (date)
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
96 "Compute the Islamic date (month day year) corresponding to absolute DATE.
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
97 The absolute date is the number of days elapsed since the (imaginary)
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
98 Gregorian date Sunday, December 31, 1 BC."
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
99 (if (< date calendar-islamic-epoch)
92644
df2219fdc233 Formatting changes only.
Glenn Morris <rgm@gnu.org>
parents: 92610
diff changeset
100 (list 0 0 0) ; pre-Islamic date
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
101 (let* ((approx (/ (- date calendar-islamic-epoch)
92644
df2219fdc233 Formatting changes only.
Glenn Morris <rgm@gnu.org>
parents: 92610
diff changeset
102 355)) ; approximation from below
df2219fdc233 Formatting changes only.
Glenn Morris <rgm@gnu.org>
parents: 92610
diff changeset
103 (year ; search forward from the approximation
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
104 (+ approx
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
105 (calendar-sum y approx
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
106 (>= date (calendar-islamic-to-absolute
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
107 (list 1 1 (1+ y))))
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
108 1)))
92644
df2219fdc233 Formatting changes only.
Glenn Morris <rgm@gnu.org>
parents: 92610
diff changeset
109 (month ; search forward from Muharram
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
110 (1+ (calendar-sum m 1
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
111 (> date
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
112 (calendar-islamic-to-absolute
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
113 (list m
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
114 (calendar-islamic-last-day-of-month
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
115 m year)
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
116 year)))
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
117 1)))
92644
df2219fdc233 Formatting changes only.
Glenn Morris <rgm@gnu.org>
parents: 92610
diff changeset
118 (day ; calculate the day by subtraction
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
119 (- date
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
120 (1- (calendar-islamic-to-absolute (list month 1 year))))))
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
121 (list month day year))))
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
122
92832
0f2bf92fe13d (generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents: 92677
diff changeset
123 ;;;###cal-autoload
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
124 (defun calendar-islamic-date-string (&optional date)
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
125 "String of Islamic date before sunset of Gregorian DATE.
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
126 Returns the empty string if DATE is pre-Islamic.
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
127 Defaults to today's date if DATE is not given.
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
128 Driven by the variable `calendar-date-display-form'."
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
129 (let ((calendar-month-name-array calendar-islamic-month-name-array)
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
130 (islamic-date (calendar-islamic-from-absolute
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
131 (calendar-absolute-from-gregorian
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
132 (or date (calendar-current-date))))))
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
133 (if (< (extract-calendar-year islamic-date) 1)
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
134 ""
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
135 (calendar-date-string islamic-date nil t))))
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
136
92832
0f2bf92fe13d (generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents: 92677
diff changeset
137 ;;;###cal-autoload
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
138 (defun calendar-islamic-print-date ()
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
139 "Show the Islamic calendar equivalent of the date under the cursor."
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
140 (interactive)
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
141 (let ((i (calendar-islamic-date-string (calendar-cursor-to-date t))))
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
142 (if (string-equal i "")
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
143 (message "Date is pre-Islamic")
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
144 (message "Islamic date (until sunset): %s" i))))
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
145
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
146 (define-obsolete-function-alias 'calendar-print-islamic-date
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
147 'calendar-islamic-print-date "23.1")
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
148
93184
63a7509590a7 (calendar-islamic-read-date): New name for
Glenn Morris <rgm@gnu.org>
parents: 92991
diff changeset
149 (defun calendar-islamic-read-date ()
63a7509590a7 (calendar-islamic-read-date): New name for
Glenn Morris <rgm@gnu.org>
parents: 92991
diff changeset
150 "Interactively read the arguments for an Islamic date command.
63a7509590a7 (calendar-islamic-read-date): New name for
Glenn Morris <rgm@gnu.org>
parents: 92991
diff changeset
151 Reads a year, month, and day."
92991
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
152 (let* ((today (calendar-current-date))
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
153 (year (calendar-read
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
154 "Islamic calendar year (>0): "
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
155 (lambda (x) (> x 0))
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
156 (int-to-string
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
157 (extract-calendar-year
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
158 (calendar-islamic-from-absolute
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
159 (calendar-absolute-from-gregorian today))))))
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
160 (month-array calendar-islamic-month-name-array)
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
161 (completion-ignore-case t)
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
162 (month (cdr (assoc-string
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
163 (completing-read
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
164 "Islamic calendar month name: "
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
165 (mapcar 'list (append month-array nil))
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
166 nil t)
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
167 (calendar-make-alist month-array 1) t)))
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
168 (last (calendar-islamic-last-day-of-month month year))
92991
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
169 (day (calendar-read
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
170 (format "Islamic calendar day (1-%d): " last)
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
171 (lambda (x) (and (< 0 x) (<= x last))))))
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
172 (list (list month day year))))
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
173
92832
0f2bf92fe13d (generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents: 92677
diff changeset
174 ;;;###cal-autoload
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
175 (defun calendar-islamic-goto-date (date &optional noecho)
92926
b87a8e95883b (displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents: 92832
diff changeset
176 "Move cursor to Islamic DATE; echo Islamic date unless NOECHO is non-nil."
93184
63a7509590a7 (calendar-islamic-read-date): New name for
Glenn Morris <rgm@gnu.org>
parents: 92991
diff changeset
177 (interactive (calendar-islamic-read-date))
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
178 (calendar-goto-date (calendar-gregorian-from-absolute
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
179 (calendar-islamic-to-absolute date)))
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
180 (or noecho (calendar-islamic-print-date)))
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
181
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
182 (define-obsolete-function-alias 'calendar-goto-islamic-date
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
183 'calendar-islamic-goto-date "23.1")
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
184
92926
b87a8e95883b (displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents: 92832
diff changeset
185 (defvar displayed-month) ; from generate-calendar
b87a8e95883b (displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents: 92832
diff changeset
186 (defvar displayed-year)
b87a8e95883b (displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents: 92832
diff changeset
187
92832
0f2bf92fe13d (generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents: 92677
diff changeset
188 ;;;###holiday-autoload
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
189 (defun holiday-islamic (month day string)
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
190 "Holiday on MONTH, DAY (Islamic) called STRING.
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
191 If MONTH, DAY (Islamic) is visible, the value returned is corresponding
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
192 Gregorian date in the form of the list (((month day year) STRING)). Returns
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
193 nil if it is not visible in the current calendar window."
93462
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
194 ;; Islamic date corresponding to the center of the calendar window.
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
195 ;; Since the calendar displays 3 months at a time, there are approx
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
196 ;; 45 visible days either side of this date. Given the length of
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
197 ;; the Islamic months, this means up to two different months are
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
198 ;; visible either side of the central date.
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
199 (let* ((islamic-date (calendar-islamic-from-absolute
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
200 (calendar-absolute-from-gregorian
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
201 (list displayed-month 15 displayed-year))))
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
202 (m (extract-calendar-month islamic-date))
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
203 (y (extract-calendar-year islamic-date))
93373
6facf919dde4 Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents: 93268
diff changeset
204 date)
92926
b87a8e95883b (displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents: 92832
diff changeset
205 (unless (< m 1) ; Islamic calendar doesn't apply
93462
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
206 ;; Since converting to absolute dates can be a complex
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
207 ;; operation, we try to speed things up by excluding those date
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
208 ;; ranges that can't possibly be visible.
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
209 ;; We can view the situation (see above) as if we had a calendar
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
210 ;; window displaying 5 months at a time. When month m is
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
211 ;; central, months m-2:m+2 (modulo 12) might be visible.
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
212 ;; Recall from holiday-fixed that with a 3 month calendar
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
213 ;; window, November is special, because we can do a one-sided
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
214 ;; inclusion test. When November is central is when the end of
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
215 ;; year first appears on the calendar. Similarly, with a 5
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
216 ;; month window, October is special. When October is central is
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
217 ;; when the end of year first appears, and when January is
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
218 ;; central, October is no longer visible. October is visible
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
219 ;; when the central month is >= 8.
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
220 ;; Hence to test if any given month might be visible, we can
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
221 ;; shift things and ask about October.
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
222 ;; At the same time, we work out the appropriate year y to use.
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
223 (increment-calendar-month m y (- 10 month))
93462
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
224 (and (> m 7) ; Islamic date might be visible
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
225 (calendar-date-is-visible-p
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
226 (setq date (calendar-gregorian-from-absolute
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
227 (calendar-islamic-to-absolute (list month day y)))))
93462
263786b8fe73 (Commentary): Replace with reference to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93373
diff changeset
228 (list (list date string))))))
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
229
93577
bac2b63b476f (holiday-islamic-new-year): New function.
Glenn Morris <rgm@gnu.org>
parents: 93471
diff changeset
230 ;;;###holiday-autoload
bac2b63b476f (holiday-islamic-new-year): New function.
Glenn Morris <rgm@gnu.org>
parents: 93471
diff changeset
231 (defun holiday-islamic-new-year ()
bac2b63b476f (holiday-islamic-new-year): New function.
Glenn Morris <rgm@gnu.org>
parents: 93471
diff changeset
232 "Holiday entry for the Islamic New Year, if visible in the calendar window."
bac2b63b476f (holiday-islamic-new-year): New function.
Glenn Morris <rgm@gnu.org>
parents: 93471
diff changeset
233 (let ((date (caar (holiday-islamic 1 1 "")))
bac2b63b476f (holiday-islamic-new-year): New function.
Glenn Morris <rgm@gnu.org>
parents: 93471
diff changeset
234 (m displayed-month)
bac2b63b476f (holiday-islamic-new-year): New function.
Glenn Morris <rgm@gnu.org>
parents: 93471
diff changeset
235 (y displayed-year))
bac2b63b476f (holiday-islamic-new-year): New function.
Glenn Morris <rgm@gnu.org>
parents: 93471
diff changeset
236 (and date
bac2b63b476f (holiday-islamic-new-year): New function.
Glenn Morris <rgm@gnu.org>
parents: 93471
diff changeset
237 (list (list date
bac2b63b476f (holiday-islamic-new-year): New function.
Glenn Morris <rgm@gnu.org>
parents: 93471
diff changeset
238 (format "Islamic New Year %d"
bac2b63b476f (holiday-islamic-new-year): New function.
Glenn Morris <rgm@gnu.org>
parents: 93471
diff changeset
239 (progn
bac2b63b476f (holiday-islamic-new-year): New function.
Glenn Morris <rgm@gnu.org>
parents: 93471
diff changeset
240 (increment-calendar-month m y 1)
bac2b63b476f (holiday-islamic-new-year): New function.
Glenn Morris <rgm@gnu.org>
parents: 93471
diff changeset
241 (extract-calendar-year
bac2b63b476f (holiday-islamic-new-year): New function.
Glenn Morris <rgm@gnu.org>
parents: 93471
diff changeset
242 (calendar-islamic-from-absolute
bac2b63b476f (holiday-islamic-new-year): New function.
Glenn Morris <rgm@gnu.org>
parents: 93471
diff changeset
243 (calendar-absolute-from-gregorian
bac2b63b476f (holiday-islamic-new-year): New function.
Glenn Morris <rgm@gnu.org>
parents: 93471
diff changeset
244 (list m (calendar-last-day-of-month m y) y)
bac2b63b476f (holiday-islamic-new-year): New function.
Glenn Morris <rgm@gnu.org>
parents: 93471
diff changeset
245 ))))))))))
bac2b63b476f (holiday-islamic-new-year): New function.
Glenn Morris <rgm@gnu.org>
parents: 93471
diff changeset
246
92971
56c7e60586c9 (number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents: 92926
diff changeset
247 (autoload 'diary-list-entries-1 "diary-lib")
92677
3f32c597cb6b (diary-islamic-date): Move to end.
Glenn Morris <rgm@gnu.org>
parents: 92645
diff changeset
248
92832
0f2bf92fe13d (generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents: 92677
diff changeset
249 ;;;###diary-autoload
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
250 (defun diary-islamic-list-entries ()
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
251 "Add any Islamic date entries from the diary file to `diary-entries-list'.
92645
611e312d3f05 (islamic-calendar-leap-year-p)
Glenn Morris <rgm@gnu.org>
parents: 92644
diff changeset
252 Islamic date diary entries must be prefaced by `islamic-diary-entry-symbol'
92971
56c7e60586c9 (number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents: 92926
diff changeset
253 \(normally an `I'). The same `diary-date-forms' govern the style
92645
611e312d3f05 (islamic-calendar-leap-year-p)
Glenn Morris <rgm@gnu.org>
parents: 92644
diff changeset
254 of the Islamic calendar entries, except that the Islamic month
93268
691804e8889b (list-islamic-diary-entries): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 93223
diff changeset
255 names cannot be abbreviated. The Islamic months are numbered
92645
611e312d3f05 (islamic-calendar-leap-year-p)
Glenn Morris <rgm@gnu.org>
parents: 92644
diff changeset
256 from 1 to 12 with Muharram being 1 and 12 being Dhu al-Hijjah.
611e312d3f05 (islamic-calendar-leap-year-p)
Glenn Morris <rgm@gnu.org>
parents: 92644
diff changeset
257 If an Islamic date diary entry begins with `diary-nonmarking-symbol',
611e312d3f05 (islamic-calendar-leap-year-p)
Glenn Morris <rgm@gnu.org>
parents: 92644
diff changeset
258 the entry will appear in the diary listing, but will not be
611e312d3f05 (islamic-calendar-leap-year-p)
Glenn Morris <rgm@gnu.org>
parents: 92644
diff changeset
259 marked in the calendar. This function is provided for use with
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
260 `nongregorian-diary-listing-hook'."
92971
56c7e60586c9 (number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents: 92926
diff changeset
261 (diary-list-entries-1 calendar-islamic-month-name-array
56c7e60586c9 (number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents: 92926
diff changeset
262 islamic-diary-entry-symbol
56c7e60586c9 (number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents: 92926
diff changeset
263 'calendar-islamic-from-absolute))
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
264
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
265 (define-obsolete-function-alias 'list-islamic-diary-entries
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
266 'diary-islamic-list-entries "23.1")
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
267
92991
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
268 (autoload 'calendar-mark-1 "diary-lib")
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
269
92832
0f2bf92fe13d (generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents: 92677
diff changeset
270 ;;;###diary-autoload
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
271 (defun calendar-islamic-mark-date-pattern (month day year &optional color)
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
272 "Mark dates in calendar window that conform to Islamic date MONTH/DAY/YEAR.
92991
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
273 A value of 0 in any position is a wildcard. Optional argument COLOR is
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
274 passed to `mark-visible-calendar-date' as MARK."
24a6717aed7f (calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents: 92971
diff changeset
275 (calendar-mark-1 month day year 'calendar-islamic-from-absolute
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
276 'calendar-islamic-to-absolute color))
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
277
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
278 (define-obsolete-function-alias 'mark-islamic-calendar-date-pattern
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
279 'calendar-islamic-mark-date-pattern "23.1")
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
280
92971
56c7e60586c9 (number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents: 92926
diff changeset
281 (autoload 'diary-mark-entries-1 "diary-lib")
92926
b87a8e95883b (displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents: 92832
diff changeset
282
b87a8e95883b (displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents: 92832
diff changeset
283 ;;;###diary-autoload
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
284 (defun diary-islamic-mark-entries ()
92926
b87a8e95883b (displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents: 92832
diff changeset
285 "Mark days in the calendar window that have Islamic date diary entries.
92971
56c7e60586c9 (number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents: 92926
diff changeset
286 Marks each entry in `diary-file' (or included files) visible in the calendar
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
287 window. See `diary-islamic-list-entries' for more information."
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
288 (diary-mark-entries-1 'calendar-islamic-mark-date-pattern
93471
31158dd82f24 (mark-islamic-diary-entries): Fix argument order in call to
Glenn Morris <rgm@gnu.org>
parents: 93462
diff changeset
289 calendar-islamic-month-name-array
92971
56c7e60586c9 (number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents: 92926
diff changeset
290 islamic-diary-entry-symbol
93471
31158dd82f24 (mark-islamic-diary-entries): Fix argument order in call to
Glenn Morris <rgm@gnu.org>
parents: 93462
diff changeset
291 'calendar-islamic-from-absolute))
92926
b87a8e95883b (displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents: 92832
diff changeset
292
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
293 (define-obsolete-function-alias
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
294 'mark-islamic-diary-entries 'diary-islamic-mark-entries "23.1")
93373
6facf919dde4 Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents: 93268
diff changeset
295
6facf919dde4 Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents: 93268
diff changeset
296 (autoload 'diary-insert-entry-1 "diary-lib")
6facf919dde4 Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents: 93268
diff changeset
297
92832
0f2bf92fe13d (generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents: 92677
diff changeset
298 ;;;###cal-autoload
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
299 (defun diary-islamic-insert-entry (arg)
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
300 "Insert a diary entry.
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
301 For the Islamic date corresponding to the date indicated by point.
92645
611e312d3f05 (islamic-calendar-leap-year-p)
Glenn Morris <rgm@gnu.org>
parents: 92644
diff changeset
302 Prefix argument ARG makes the entry nonmarking."
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
303 (interactive "P")
93373
6facf919dde4 Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents: 93268
diff changeset
304 (diary-insert-entry-1 nil arg calendar-islamic-month-name-array
6facf919dde4 Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents: 93268
diff changeset
305 islamic-diary-entry-symbol
6facf919dde4 Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents: 93268
diff changeset
306 'calendar-islamic-from-absolute))
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
307
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
308 (define-obsolete-function-alias 'insert-islamic-diary-entry
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
309 'diary-islamic-insert-entry "23.1")
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
310
92832
0f2bf92fe13d (generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents: 92677
diff changeset
311 ;;;###cal-autoload
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
312 (defun diary-islamic-insert-monthly-entry (arg)
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
313 "Insert a monthly diary entry.
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
314 For the day of the Islamic month corresponding to the date indicated by point.
92645
611e312d3f05 (islamic-calendar-leap-year-p)
Glenn Morris <rgm@gnu.org>
parents: 92644
diff changeset
315 Prefix argument ARG makes the entry nonmarking."
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
316 (interactive "P")
93373
6facf919dde4 Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents: 93268
diff changeset
317 (diary-insert-entry-1 'monthly arg calendar-islamic-month-name-array
6facf919dde4 Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents: 93268
diff changeset
318 islamic-diary-entry-symbol
6facf919dde4 Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents: 93268
diff changeset
319 'calendar-islamic-from-absolute))
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
320
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
321 (define-obsolete-function-alias 'insert-monthly-islamic-diary-entry
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
322 'diary-islamic-insert-monthly-entry "23.1")
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
323
92832
0f2bf92fe13d (generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents: 92677
diff changeset
324 ;;;###cal-autoload
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
325 (defun diary-islamic-insert-yearly-entry (arg)
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
326 "Insert an annual diary entry.
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
327 For the day of the Islamic year corresponding to the date indicated by point.
92645
611e312d3f05 (islamic-calendar-leap-year-p)
Glenn Morris <rgm@gnu.org>
parents: 92644
diff changeset
328 Prefix argument ARG makes the entry nonmarking."
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
329 (interactive "P")
93373
6facf919dde4 Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents: 93268
diff changeset
330 (diary-insert-entry-1 'yearly arg calendar-islamic-month-name-array
6facf919dde4 Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents: 93268
diff changeset
331 islamic-diary-entry-symbol
6facf919dde4 Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents: 93268
diff changeset
332 'calendar-islamic-from-absolute))
93642
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
333 (define-obsolete-function-alias
d01118f40990 Update for cal-julian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93577
diff changeset
334 'insert-yearly-islamic-diary-entry 'diary-islamic-insert-yearly-entry "23.1")
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
335
92677
3f32c597cb6b (diary-islamic-date): Move to end.
Glenn Morris <rgm@gnu.org>
parents: 92645
diff changeset
336 (defvar date)
3f32c597cb6b (diary-islamic-date): Move to end.
Glenn Morris <rgm@gnu.org>
parents: 92645
diff changeset
337
3f32c597cb6b (diary-islamic-date): Move to end.
Glenn Morris <rgm@gnu.org>
parents: 92645
diff changeset
338 ;; To be called from diary-sexp-entry, where DATE, ENTRY are bound.
92832
0f2bf92fe13d (generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents: 92677
diff changeset
339 ;;;###diary-autoload
92677
3f32c597cb6b (diary-islamic-date): Move to end.
Glenn Morris <rgm@gnu.org>
parents: 92645
diff changeset
340 (defun diary-islamic-date ()
3f32c597cb6b (diary-islamic-date): Move to end.
Glenn Morris <rgm@gnu.org>
parents: 92645
diff changeset
341 "Islamic calendar equivalent of date diary entry."
3f32c597cb6b (diary-islamic-date): Move to end.
Glenn Morris <rgm@gnu.org>
parents: 92645
diff changeset
342 (let ((i (calendar-islamic-date-string date)))
3f32c597cb6b (diary-islamic-date): Move to end.
Glenn Morris <rgm@gnu.org>
parents: 92645
diff changeset
343 (if (string-equal i "")
3f32c597cb6b (diary-islamic-date): Move to end.
Glenn Morris <rgm@gnu.org>
parents: 92645
diff changeset
344 "Date is pre-Islamic"
3f32c597cb6b (diary-islamic-date): Move to end.
Glenn Morris <rgm@gnu.org>
parents: 92645
diff changeset
345 (format "Islamic date (until sunset): %s" i))))
3f32c597cb6b (diary-islamic-date): Move to end.
Glenn Morris <rgm@gnu.org>
parents: 92645
diff changeset
346
14684
66450c507ee4 Renamed from cal-islamic.el to avoid 14-character limitation.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
347 (provide 'cal-islam)
13053
621d48117fde Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
348
92585
c9eb56890fe0 Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
349 ;; arch-tag: a951b6c1-6f47-48d5-bac3-1b505cd719f7
14684
66450c507ee4 Renamed from cal-islamic.el to avoid 14-character limitation.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
350 ;;; cal-islam.el ends here