Mercurial > emacs
annotate lisp/calendar/cal-islam.el @ 93195:096de5eb1d54
(verilog-auto-output)
(verilog-auto-input, verilog-auto-inout, verilog-auto)
(verilog-delete-auto): Add optional regular expression to
AUTOINPUT/AUTOOUTPUT/AUTOINOUT.
(verilog-signals-matching-regexp): New internal function for
signal matching.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Tue, 25 Mar 2008 15:45:49 +0000 |
parents | 63a7509590a7 |
children | 9aca848375df |
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 | 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 | 5 |
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 | 8 ;; Keywords: calendar |
9 ;; Human-Keywords: Islamic calendar, calendar, diary | |
10 | |
11 ;; This file is part of GNU Emacs. | |
12 | |
13 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
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 | 16 ;; any later version. |
17 | |
18 ;; GNU Emacs is distributed in the hope that it will be useful, | |
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 ;; GNU General Public License for more details. | |
22 | |
23 ;; You should have received a copy of the GNU General Public License | |
14169 | 24 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64085 | 25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
26 ;; Boston, MA 02110-1301, USA. | |
13053 | 27 |
28 ;;; Commentary: | |
29 | |
30 ;; This collection of functions implements the features of calendar.el and | |
31 ;; diary.el that deal with the Islamic calendar. | |
32 | |
20462
d179de7ad92e
Add reference to new Calendrical Calculations book.
Paul Eggert <eggert@twinsun.com>
parents:
20268
diff
changeset
|
33 ;; Technical details of all the calendrical calculations can be found in |
61148
7f7db25577d9
Update reference to "Calendrical Calculations" book; there's a new edition.
Paul Eggert <eggert@twinsun.com>
parents:
54075
diff
changeset
|
34 ;; ``Calendrical Calculations: The Millennium Edition'' by Edward M. Reingold |
7f7db25577d9
Update reference to "Calendrical Calculations" book; there's a new edition.
Paul Eggert <eggert@twinsun.com>
parents:
54075
diff
changeset
|
35 ;; and Nachum Dershowitz, Cambridge University Press (2001). |
20462
d179de7ad92e
Add reference to new Calendrical Calculations book.
Paul Eggert <eggert@twinsun.com>
parents:
20268
diff
changeset
|
36 |
13053 | 37 ;;; Code: |
38 | |
39 (require 'cal-julian) | |
40 | |
92971
56c7e60586c9
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92926
diff
changeset
|
41 (defconst calendar-islamic-month-name-array |
13053 | 42 ["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
|
43 "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
|
44 "Array of strings giving the names of the Islamic months.") |
13053 | 45 |
92971
56c7e60586c9
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92926
diff
changeset
|
46 (defconst calendar-islamic-epoch (calendar-absolute-from-julian '(7 16 622)) |
56c7e60586c9
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92926
diff
changeset
|
47 "Absolute date of start of Islamic calendar = August 29, 284 AD (Julian).") |
13053 | 48 |
49 (defun islamic-calendar-leap-year-p (year) | |
92645
611e312d3f05
(islamic-calendar-leap-year-p)
Glenn Morris <rgm@gnu.org>
parents:
92644
diff
changeset
|
50 "Return t if YEAR is a leap year on the Islamic calendar." |
13053 | 51 (memq (% year 30) |
52 (list 2 5 7 10 13 16 18 21 24 26 29))) | |
53 | |
54 (defun islamic-calendar-last-day-of-month (month year) | |
55 "The last day in MONTH during YEAR on the Islamic calendar." | |
56 (cond | |
57 ((memq month (list 1 3 5 7 9 11)) 30) | |
58 ((memq month (list 2 4 6 8 10)) 29) | |
59 (t (if (islamic-calendar-leap-year-p year) 30 29)))) | |
60 | |
61 (defun islamic-calendar-day-number (date) | |
62 "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
|
63 (let ((month (extract-calendar-month date))) |
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
64 (+ (* 30 (/ month 2)) |
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
65 (* 29 (/ (1- month) 2)) |
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
66 (extract-calendar-day date)))) |
13053 | 67 |
68 (defun calendar-absolute-from-islamic (date) | |
69 "Absolute date of Islamic DATE. | |
70 The absolute date is the number of days elapsed since the (imaginary) | |
71 Gregorian date Sunday, December 31, 1 BC." | |
72 (let* ((month (extract-calendar-month date)) | |
73 (day (extract-calendar-day date)) | |
74 (year (extract-calendar-year date)) | |
75 (y (% year 30)) | |
92991
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
76 (leap-years-in-cycle (cond ((< y 3) 0) |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
77 ((< y 6) 1) |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
78 ((< y 8) 2) |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
79 ((< y 11) 3) |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
80 ((< y 14) 4) |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
81 ((< y 17) 5) |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
82 ((< y 19) 6) |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
83 ((< y 22) 7) |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
84 ((< y 25) 8) |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
85 ((< y 27) 9) |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
86 (t 10)))) |
92644 | 87 (+ (islamic-calendar-day-number date) ; days so far this year |
88 (* (1- year) 354) ; days in all non-leap years | |
89 (* 11 (/ year 30)) ; leap days in complete cycles | |
90 leap-years-in-cycle ; leap days this cycle | |
91 (1- calendar-islamic-epoch)))) ; days before start of calendar | |
13053 | 92 |
93 (defun calendar-islamic-from-absolute (date) | |
94 "Compute the Islamic date (month day year) corresponding to absolute DATE. | |
95 The absolute date is the number of days elapsed since the (imaginary) | |
96 Gregorian date Sunday, December 31, 1 BC." | |
97 (if (< date calendar-islamic-epoch) | |
92644 | 98 (list 0 0 0) ; pre-Islamic date |
13053 | 99 (let* ((approx (/ (- date calendar-islamic-epoch) |
92644 | 100 355)) ; approximation from below |
101 (year ; search forward from the approximation | |
13053 | 102 (+ approx |
103 (calendar-sum y approx | |
104 (>= date (calendar-absolute-from-islamic | |
105 (list 1 1 (1+ y)))) | |
106 1))) | |
92644 | 107 (month ; search forward from Muharram |
13053 | 108 (1+ (calendar-sum m 1 |
109 (> date | |
110 (calendar-absolute-from-islamic | |
111 (list m | |
112 (islamic-calendar-last-day-of-month | |
113 m year) | |
114 year))) | |
115 1))) | |
92644 | 116 (day ; calculate the day by subtraction |
13053 | 117 (- date |
118 (1- (calendar-absolute-from-islamic (list month 1 year)))))) | |
119 (list month day year)))) | |
120 | |
92832
0f2bf92fe13d
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92677
diff
changeset
|
121 ;;;###cal-autoload |
13053 | 122 (defun calendar-islamic-date-string (&optional date) |
123 "String of Islamic date before sunset of Gregorian DATE. | |
124 Returns the empty string if DATE is pre-Islamic. | |
125 Defaults to today's date if DATE is not given. | |
126 Driven by the variable `calendar-date-display-form'." | |
127 (let ((calendar-month-name-array calendar-islamic-month-name-array) | |
128 (islamic-date (calendar-islamic-from-absolute | |
129 (calendar-absolute-from-gregorian | |
130 (or date (calendar-current-date)))))) | |
131 (if (< (extract-calendar-year islamic-date) 1) | |
132 "" | |
133 (calendar-date-string islamic-date nil t)))) | |
134 | |
92832
0f2bf92fe13d
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92677
diff
changeset
|
135 ;;;###cal-autoload |
13053 | 136 (defun calendar-print-islamic-date () |
137 "Show the Islamic calendar equivalent of the date under the cursor." | |
138 (interactive) | |
139 (let ((i (calendar-islamic-date-string (calendar-cursor-to-date t)))) | |
140 (if (string-equal i "") | |
141 (message "Date is pre-Islamic") | |
142 (message "Islamic date (until sunset): %s" i)))) | |
143 | |
93184
63a7509590a7
(calendar-islamic-read-date): New name for
Glenn Morris <rgm@gnu.org>
parents:
92991
diff
changeset
|
144 (defun calendar-islamic-read-date () |
63a7509590a7
(calendar-islamic-read-date): New name for
Glenn Morris <rgm@gnu.org>
parents:
92991
diff
changeset
|
145 "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
|
146 Reads a year, month, and day." |
92991
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
147 (let* ((today (calendar-current-date)) |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
148 (year (calendar-read |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
149 "Islamic calendar year (>0): " |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
150 (lambda (x) (> x 0)) |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
151 (int-to-string |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
152 (extract-calendar-year |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
153 (calendar-islamic-from-absolute |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
154 (calendar-absolute-from-gregorian today)))))) |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
155 (month-array calendar-islamic-month-name-array) |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
156 (completion-ignore-case t) |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
157 (month (cdr (assoc-string |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
158 (completing-read |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
159 "Islamic calendar month name: " |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
160 (mapcar 'list (append month-array nil)) |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
161 nil t) |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
162 (calendar-make-alist month-array 1) t))) |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
163 (last (islamic-calendar-last-day-of-month month year)) |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
164 (day (calendar-read |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
165 (format "Islamic calendar day (1-%d): " last) |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
166 (lambda (x) (and (< 0 x) (<= x last)))))) |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
167 (list (list month day year)))) |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
168 |
92832
0f2bf92fe13d
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92677
diff
changeset
|
169 ;;;###cal-autoload |
13053 | 170 (defun calendar-goto-islamic-date (date &optional noecho) |
92926
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
171 "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
|
172 (interactive (calendar-islamic-read-date)) |
13053 | 173 (calendar-goto-date (calendar-gregorian-from-absolute |
174 (calendar-absolute-from-islamic date))) | |
175 (or noecho (calendar-print-islamic-date))) | |
176 | |
92926
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
177 (defvar displayed-month) ; from generate-calendar |
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
178 (defvar displayed-year) |
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
179 |
92832
0f2bf92fe13d
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92677
diff
changeset
|
180 ;;;###holiday-autoload |
13053 | 181 (defun holiday-islamic (month day string) |
182 "Holiday on MONTH, DAY (Islamic) called STRING. | |
183 If MONTH, DAY (Islamic) is visible, the value returned is corresponding | |
184 Gregorian date in the form of the list (((month day year) STRING)). Returns | |
185 nil if it is not visible in the current calendar window." | |
186 (let* ((islamic-date (calendar-islamic-from-absolute | |
187 (calendar-absolute-from-gregorian | |
188 (list displayed-month 15 displayed-year)))) | |
189 (m (extract-calendar-month islamic-date)) | |
190 (y (extract-calendar-year islamic-date)) | |
191 (date)) | |
92926
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
192 (unless (< m 1) ; Islamic calendar doesn't apply |
13053 | 193 (increment-calendar-month m y (- 10 month)) |
92926
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
194 (if (> m 7) ; Islamic date might be visible |
13053 | 195 (let ((date (calendar-gregorian-from-absolute |
196 (calendar-absolute-from-islamic (list month day y))))) | |
197 (if (calendar-date-is-visible-p date) | |
198 (list (list date string)))))))) | |
199 | |
92971
56c7e60586c9
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92926
diff
changeset
|
200 (autoload 'diary-list-entries-1 "diary-lib") |
92677
3f32c597cb6b
(diary-islamic-date): Move to end.
Glenn Morris <rgm@gnu.org>
parents:
92645
diff
changeset
|
201 |
92832
0f2bf92fe13d
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92677
diff
changeset
|
202 ;;;###diary-autoload |
13053 | 203 (defun list-islamic-diary-entries () |
204 "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
|
205 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
|
206 \(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
|
207 of the Islamic calendar entries, except that the Islamic month |
611e312d3f05
(islamic-calendar-leap-year-p)
Glenn Morris <rgm@gnu.org>
parents:
92644
diff
changeset
|
208 names must be spelled in full. The Islamic months are numbered |
611e312d3f05
(islamic-calendar-leap-year-p)
Glenn Morris <rgm@gnu.org>
parents:
92644
diff
changeset
|
209 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
|
210 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
|
211 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
|
212 marked in the calendar. This function is provided for use with |
13053 | 213 `nongregorian-diary-listing-hook'." |
92971
56c7e60586c9
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92926
diff
changeset
|
214 (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
|
215 islamic-diary-entry-symbol |
56c7e60586c9
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92926
diff
changeset
|
216 'calendar-islamic-from-absolute)) |
13053 | 217 |
92991
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
218 (autoload 'calendar-mark-1 "diary-lib") |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
219 |
92832
0f2bf92fe13d
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92677
diff
changeset
|
220 ;;;###diary-autoload |
92991
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
221 (defun mark-islamic-calendar-date-pattern (month day year &optional color) |
13053 | 222 "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
|
223 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
|
224 passed to `mark-visible-calendar-date' as MARK." |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
225 (calendar-mark-1 month day year 'calendar-islamic-from-absolute |
24a6717aed7f
(calendar-mark-1): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92971
diff
changeset
|
226 'calendar-absolute-from-islamic color)) |
13053 | 227 |
92971
56c7e60586c9
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92926
diff
changeset
|
228 (autoload 'diary-mark-entries-1 "diary-lib") |
92926
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
229 |
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
230 ;;;###diary-autoload |
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
231 (defun mark-islamic-diary-entries () |
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
232 "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
|
233 Marks each entry in `diary-file' (or included files) visible in the calendar |
56c7e60586c9
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92926
diff
changeset
|
234 window. See `list-islamic-diary-entries' for more information." |
56c7e60586c9
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92926
diff
changeset
|
235 (diary-mark-entries-1 calendar-islamic-month-name-array |
56c7e60586c9
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92926
diff
changeset
|
236 islamic-diary-entry-symbol |
56c7e60586c9
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92926
diff
changeset
|
237 'calendar-islamic-from-absolute |
56c7e60586c9
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92926
diff
changeset
|
238 'mark-islamic-calendar-date-pattern)) |
92926
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
239 |
92832
0f2bf92fe13d
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92677
diff
changeset
|
240 ;;;###cal-autoload |
13053 | 241 (defun insert-islamic-diary-entry (arg) |
242 "Insert a diary entry. | |
243 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
|
244 Prefix argument ARG makes the entry nonmarking." |
13053 | 245 (interactive "P") |
92926
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
246 (let ((calendar-month-name-array calendar-islamic-month-name-array)) |
13053 | 247 (make-diary-entry |
92926
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
248 (concat islamic-diary-entry-symbol |
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
249 (calendar-date-string |
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
250 (calendar-islamic-from-absolute |
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
251 (calendar-absolute-from-gregorian (calendar-cursor-to-date t))) |
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
252 nil t)) |
13053 | 253 arg))) |
254 | |
92832
0f2bf92fe13d
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92677
diff
changeset
|
255 ;;;###cal-autoload |
13053 | 256 (defun insert-monthly-islamic-diary-entry (arg) |
257 "Insert a monthly diary entry. | |
258 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
|
259 Prefix argument ARG makes the entry nonmarking." |
13053 | 260 (interactive "P") |
92926
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
261 (let ((calendar-date-display-form (if european-calendar-style |
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
262 '(day " * ") |
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
263 '("* " day ))) |
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
264 (calendar-month-name-array calendar-islamic-month-name-array)) |
13053 | 265 (make-diary-entry |
92926
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
266 (concat islamic-diary-entry-symbol |
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
267 (calendar-date-string |
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
268 (calendar-islamic-from-absolute |
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
269 (calendar-absolute-from-gregorian (calendar-cursor-to-date t))))) |
13053 | 270 arg))) |
271 | |
92832
0f2bf92fe13d
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92677
diff
changeset
|
272 ;;;###cal-autoload |
13053 | 273 (defun insert-yearly-islamic-diary-entry (arg) |
274 "Insert an annual diary entry. | |
275 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
|
276 Prefix argument ARG makes the entry nonmarking." |
13053 | 277 (interactive "P") |
92926
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
278 (let ((calendar-date-display-form (if european-calendar-style |
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
279 '(day " " monthname) |
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
280 '(monthname " " day))) |
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
281 (calendar-month-name-array calendar-islamic-month-name-array)) |
13053 | 282 (make-diary-entry |
92926
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
283 (concat islamic-diary-entry-symbol |
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
284 (calendar-date-string |
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
285 (calendar-islamic-from-absolute |
b87a8e95883b
(displayed-month, displayed-year)
Glenn Morris <rgm@gnu.org>
parents:
92832
diff
changeset
|
286 (calendar-absolute-from-gregorian (calendar-cursor-to-date t))))) |
13053 | 287 arg))) |
288 | |
92677
3f32c597cb6b
(diary-islamic-date): Move to end.
Glenn Morris <rgm@gnu.org>
parents:
92645
diff
changeset
|
289 (defvar date) |
3f32c597cb6b
(diary-islamic-date): Move to end.
Glenn Morris <rgm@gnu.org>
parents:
92645
diff
changeset
|
290 |
3f32c597cb6b
(diary-islamic-date): Move to end.
Glenn Morris <rgm@gnu.org>
parents:
92645
diff
changeset
|
291 ;; 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
|
292 ;;;###diary-autoload |
92677
3f32c597cb6b
(diary-islamic-date): Move to end.
Glenn Morris <rgm@gnu.org>
parents:
92645
diff
changeset
|
293 (defun diary-islamic-date () |
3f32c597cb6b
(diary-islamic-date): Move to end.
Glenn Morris <rgm@gnu.org>
parents:
92645
diff
changeset
|
294 "Islamic calendar equivalent of date diary entry." |
3f32c597cb6b
(diary-islamic-date): Move to end.
Glenn Morris <rgm@gnu.org>
parents:
92645
diff
changeset
|
295 (let ((i (calendar-islamic-date-string date))) |
3f32c597cb6b
(diary-islamic-date): Move to end.
Glenn Morris <rgm@gnu.org>
parents:
92645
diff
changeset
|
296 (if (string-equal i "") |
3f32c597cb6b
(diary-islamic-date): Move to end.
Glenn Morris <rgm@gnu.org>
parents:
92645
diff
changeset
|
297 "Date is pre-Islamic" |
3f32c597cb6b
(diary-islamic-date): Move to end.
Glenn Morris <rgm@gnu.org>
parents:
92645
diff
changeset
|
298 (format "Islamic date (until sunset): %s" i)))) |
3f32c597cb6b
(diary-islamic-date): Move to end.
Glenn Morris <rgm@gnu.org>
parents:
92645
diff
changeset
|
299 |
14684
66450c507ee4
Renamed from cal-islamic.el to avoid 14-character limitation.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
300 (provide 'cal-islam) |
13053 | 301 |
92585
c9eb56890fe0
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
302 ;; 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
|
303 ;;; cal-islam.el ends here |