diff options
| author | John Wiegley | 2001-03-20 20:26:13 +0000 |
|---|---|---|
| committer | John Wiegley | 2001-03-20 20:26:13 +0000 |
| commit | 341c19b9d0b4f3376a221d4eabba6b369f644ad5 (patch) | |
| tree | f2c573239681e20be4a651449329db3960d6518b | |
| parent | 7194219dd32abc3d6e35cb5acd18f3a34c2cec67 (diff) | |
| download | emacs-341c19b9d0b4f3376a221d4eabba6b369f644ad5.tar.gz emacs-341c19b9d0b4f3376a221d4eabba6b369f644ad5.zip | |
See ChangeLog
| -rw-r--r-- | lisp/ChangeLog | 12 | ||||
| -rw-r--r-- | lisp/calendar/cal-bahai.el | 486 | ||||
| -rw-r--r-- | lisp/calendar/cal-menu.el | 21 | ||||
| -rw-r--r-- | lisp/calendar/calendar.el | 205 | ||||
| -rw-r--r-- | lisp/calendar/diary-lib.el | 16 | ||||
| -rw-r--r-- | lisp/calendar/holidays.el | 5 | ||||
| -rw-r--r-- | lisp/pcvs-util.el | 4 |
7 files changed, 699 insertions, 50 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8345bf8ee9a..80b85ef1ad8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2001-03-20 John Wiegley <johnw@gnu.org> | ||
| 2 | |||
| 3 | * calendar/calendar.el (nongregorian-diary-listing-hook): Added | ||
| 4 | :options to cover the possible values. | ||
| 5 | (nongregorian-diary-marking-hook): ditto | ||
| 6 | |||
| 7 | * cal-bahai.el, cal-menu.el, calendar.el, diary-lib.el, | ||
| 8 | holidays.el: Added support for the Baha'i calendar system. | ||
| 9 | |||
| 10 | * pcvs-util.el (cvs-bury-buffer): Bodiless `if' statements cause | ||
| 11 | problems for the interpreter. | ||
| 12 | |||
| 1 | 2001-03-20 Gerd Moellmann <gerd@gnu.org> | 13 | 2001-03-20 Gerd Moellmann <gerd@gnu.org> |
| 2 | 14 | ||
| 3 | * follow.el (follow-avoid-tail-recenter): Doc fix. | 15 | * follow.el (follow-avoid-tail-recenter): Doc fix. |
diff --git a/lisp/calendar/cal-bahai.el b/lisp/calendar/cal-bahai.el new file mode 100644 index 00000000000..3789bb7abc7 --- /dev/null +++ b/lisp/calendar/cal-bahai.el | |||
| @@ -0,0 +1,486 @@ | |||
| 1 | ;;; cal-bahai.el --- calendar functions for the Baha'i calendar. | ||
| 2 | |||
| 3 | ;; Copyright (C) 2001 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | ||
| 6 | ;; Keywords: calendar | ||
| 7 | ;; Human-Keywords: Baha'i calendar, Baha'i, Bahai, calendar, diary | ||
| 8 | |||
| 9 | ;; This file is part of GNU Emacs. | ||
| 10 | |||
| 11 | ;; GNU Emacs is free software; you can redistribute it and/or modify | ||
| 12 | ;; it under the terms of the GNU General Public License as published by | ||
| 13 | ;; the Free Software Foundation; either version 2, or (at your option) | ||
| 14 | ;; any later version. | ||
| 15 | |||
| 16 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 19 | ;; GNU General Public License for more details. | ||
| 20 | |||
| 21 | ;; You should have received a copy of the GNU General Public License | ||
| 22 | ;; along with GNU Emacs; see the file COPYING. If not, write to the | ||
| 23 | ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
| 24 | ;; Boston, MA 02111-1307, USA. | ||
| 25 | |||
| 26 | ;;; Commentary: | ||
| 27 | |||
| 28 | ;; This collection of functions implements the features of calendar.el | ||
| 29 | ;; and diary.el that deal with the Baha'i calendar. | ||
| 30 | |||
| 31 | ;; Note: The days of Ayyam-i-Ha are encoded as zero and negative | ||
| 32 | ;; offsets from the first day of the final month. So, (19 -3 157) is | ||
| 33 | ;; the first day of Ayyam-i-Ha, in the year 157 BE. | ||
| 34 | |||
| 35 | ;;; Code: | ||
| 36 | |||
| 37 | (require 'cal-julian) | ||
| 38 | |||
| 39 | (defvar bahai-calendar-month-name-array | ||
| 40 | ["Baha" "Jalal" "Jamal" "`Azamat" "Nur" "Rahmat" "Kalimat" "Kamal" | ||
| 41 | "Asma" "`Izzat" "Mashiyyat" "`Ilm" "Qudrat" "Qawl" "Masa'il" | ||
| 42 | "Sharaf" "Sultan" "Mulk" "`Ala"]) | ||
| 43 | |||
| 44 | (defvar calendar-bahai-epoch (calendar-absolute-from-gregorian '(3 21 1844)) | ||
| 45 | "Absolute date of start of Baha'i calendar = March 19, 622 A.D. (Julian).") | ||
| 46 | |||
| 47 | (defun bahai-calendar-leap-year-p (year) | ||
| 48 | "True if YEAR is a leap year on the Baha'i calendar." | ||
| 49 | (calendar-leap-year-p (+ year 1844))) | ||
| 50 | |||
| 51 | (defvar bahai-calendar-leap-base | ||
| 52 | (+ (/ 1844 4) (- (/ 1844 100)) (/ 1844 400))) | ||
| 53 | |||
| 54 | (defun calendar-absolute-from-bahai (date) | ||
| 55 | "Compute absolute date from Baha'i date DATE. | ||
| 56 | The absolute date is the number of days elapsed since the (imaginary) | ||
| 57 | Gregorian date Sunday, December 31, 1 BC." | ||
| 58 | (let* ((month (extract-calendar-month date)) | ||
| 59 | (day (extract-calendar-day date)) | ||
| 60 | (year (extract-calendar-year date)) | ||
| 61 | (prior-years (+ (1- year) 1844)) | ||
| 62 | (leap-days (- (+ (/ prior-years 4) ; Leap days in prior years. | ||
| 63 | (- (/ prior-years 100)) | ||
| 64 | (/ prior-years 400)) | ||
| 65 | bahai-calendar-leap-base))) | ||
| 66 | (+ (1- calendar-bahai-epoch) ; Days before epoch | ||
| 67 | (* 365 (1- year)) ; Days in prior years. | ||
| 68 | leap-days | ||
| 69 | (calendar-sum m 1 (< m month) 19) | ||
| 70 | (if (= month 19) 4 0) | ||
| 71 | day))) ; Days so far this month. | ||
| 72 | |||
| 73 | (defun calendar-bahai-from-absolute (date) | ||
| 74 | "Baha'i year corresponding to the absolute DATE." | ||
| 75 | (if (< date calendar-bahai-epoch) | ||
| 76 | (list 0 0 0) ;; pre-Baha'i date | ||
| 77 | (let* ((greg (calendar-gregorian-from-absolute date)) | ||
| 78 | (year (+ (- (extract-calendar-year greg) 1844) | ||
| 79 | (if (or (> (extract-calendar-month greg) 3) | ||
| 80 | (and (= (extract-calendar-month greg) 3) | ||
| 81 | (>= (extract-calendar-day greg) 21))) | ||
| 82 | 1 0))) | ||
| 83 | (month ;; Search forward from Baha. | ||
| 84 | (1+ (calendar-sum m 1 | ||
| 85 | (> date | ||
| 86 | (calendar-absolute-from-bahai | ||
| 87 | (list m 19 year))) | ||
| 88 | 1))) | ||
| 89 | (day ;; Calculate the day by subtraction. | ||
| 90 | (- date | ||
| 91 | (1- (calendar-absolute-from-bahai (list month 1 year)))))) | ||
| 92 | (list month day year)))) | ||
| 93 | |||
| 94 | (defun calendar-bahai-date-string (&optional date) | ||
| 95 | "String of Baha'i date of Gregorian DATE. | ||
| 96 | Defaults to today's date if DATE is not given." | ||
| 97 | (let* ((bahai-date (calendar-bahai-from-absolute | ||
| 98 | (calendar-absolute-from-gregorian | ||
| 99 | (or date (calendar-current-date))))) | ||
| 100 | (y (extract-calendar-year bahai-date)) | ||
| 101 | (m (extract-calendar-month bahai-date)) | ||
| 102 | (d (extract-calendar-day bahai-date))) | ||
| 103 | (let ((monthname | ||
| 104 | (if (and (= m 19) | ||
| 105 | (<= d 0)) | ||
| 106 | "Ayyam-i-Ha" | ||
| 107 | (aref bahai-calendar-month-name-array (1- m)))) | ||
| 108 | (day (int-to-string | ||
| 109 | (if (<= d 0) | ||
| 110 | (if (bahai-calendar-leap-year-p y) | ||
| 111 | (+ d 5) | ||
| 112 | (+ d 4)) | ||
| 113 | d))) | ||
| 114 | (dayname nil) | ||
| 115 | (month (int-to-string m)) | ||
| 116 | (year (int-to-string y))) | ||
| 117 | (mapconcat 'eval calendar-date-display-form "")))) | ||
| 118 | |||
| 119 | (defun calendar-print-bahai-date () | ||
| 120 | "Show the Baha'i calendar equivalent of the selected date." | ||
| 121 | (interactive) | ||
| 122 | (message "Baha'i date: %s" | ||
| 123 | (calendar-bahai-date-string (calendar-cursor-to-date t)))) | ||
| 124 | |||
| 125 | (defun calendar-goto-bahai-date (date &optional noecho) | ||
| 126 | "Move cursor to Baha'i date DATE. | ||
| 127 | Echo Baha'i date unless NOECHO is t." | ||
| 128 | (interactive (bahai-prompt-for-date)) | ||
| 129 | (calendar-goto-date (calendar-gregorian-from-absolute | ||
| 130 | (calendar-absolute-from-bahai date))) | ||
| 131 | (or noecho (calendar-print-bahai-date))) | ||
| 132 | |||
| 133 | (defun bahai-prompt-for-date () | ||
| 134 | "Ask for a Baha'i date." | ||
| 135 | (let* ((today (calendar-current-date)) | ||
| 136 | (year (calendar-read | ||
| 137 | "Baha'i calendar year (not 0): " | ||
| 138 | '(lambda (x) (/= x 0)) | ||
| 139 | (int-to-string | ||
| 140 | (extract-calendar-year | ||
| 141 | (calendar-bahai-from-absolute | ||
| 142 | (calendar-absolute-from-gregorian today)))))) | ||
| 143 | (completion-ignore-case t) | ||
| 144 | (month (cdr (assoc | ||
| 145 | (completing-read | ||
| 146 | "Baha'i calendar month name: " | ||
| 147 | (mapcar 'list | ||
| 148 | (append bahai-calendar-month-name-array nil)) | ||
| 149 | nil t) | ||
| 150 | (calendar-make-alist bahai-calendar-month-name-array | ||
| 151 | 1)))) | ||
| 152 | (day (calendar-read "Baha'i calendar day (1-19): " | ||
| 153 | '(lambda (x) (and (< 0 x) (<= x 19)))))) | ||
| 154 | (list (list month day year)))) | ||
| 155 | |||
| 156 | (defun diary-bahai-date () | ||
| 157 | "Baha'i calendar equivalent of date diary entry." | ||
| 158 | (format "Baha'i date: %s" (calendar-bahai-date-string date))) | ||
| 159 | |||
| 160 | (defun holiday-bahai (month day string) | ||
| 161 | "Holiday on MONTH, DAY (Baha'i) called STRING. | ||
| 162 | If MONTH, DAY (Baha'i) is visible, the value returned is corresponding | ||
| 163 | Gregorian date in the form of the list (((month day year) STRING)). Returns | ||
| 164 | nil if it is not visible in the current calendar window." | ||
| 165 | (let* ((bahai-date (calendar-bahai-from-absolute | ||
| 166 | (calendar-absolute-from-gregorian | ||
| 167 | (list displayed-month 15 displayed-year)))) | ||
| 168 | (m (extract-calendar-month bahai-date)) | ||
| 169 | (y (extract-calendar-year bahai-date)) | ||
| 170 | (date)) | ||
| 171 | (if (< m 1) | ||
| 172 | nil ;; Baha'i calendar doesn't apply. | ||
| 173 | (increment-calendar-month m y (- 10 month)) | ||
| 174 | (if (> m 7) ;; Baha'i date might be visible | ||
| 175 | (let ((date (calendar-gregorian-from-absolute | ||
| 176 | (calendar-absolute-from-bahai (list month day y))))) | ||
| 177 | (if (calendar-date-is-visible-p date) | ||
| 178 | (list (list date string)))))))) | ||
| 179 | |||
| 180 | (defun list-bahai-diary-entries () | ||
| 181 | "Add any Baha'i date entries from the diary file to `diary-entries-list'. | ||
| 182 | Baha'i date diary entries must be prefaced by an | ||
| 183 | `bahai-diary-entry-symbol' (normally a `B'). The same diary date | ||
| 184 | forms govern the style of the Baha'i calendar entries, except that the | ||
| 185 | Baha'i month names must be given numerically. The Baha'i months are | ||
| 186 | numbered from 1 to 19 with Baha being 1 and 19 being `Ala. If a | ||
| 187 | Baha'i date diary entry begins with a `diary-nonmarking-symbol', the | ||
| 188 | entry will appear in the diary listing, but will not be marked in the | ||
| 189 | calendar. This function is provided for use with the | ||
| 190 | `nongregorian-diary-listing-hook'." | ||
| 191 | (if (< 0 number) | ||
| 192 | (let ((buffer-read-only nil) | ||
| 193 | (diary-modified (buffer-modified-p)) | ||
| 194 | (gdate original-date) | ||
| 195 | (mark (regexp-quote diary-nonmarking-symbol))) | ||
| 196 | (calendar-for-loop i from 1 to number do | ||
| 197 | (let* ((d diary-date-forms) | ||
| 198 | (bdate (calendar-bahai-from-absolute | ||
| 199 | (calendar-absolute-from-gregorian gdate))) | ||
| 200 | (month (extract-calendar-month bdate)) | ||
| 201 | (day (extract-calendar-day bdate)) | ||
| 202 | (year (extract-calendar-year bdate))) | ||
| 203 | (while d | ||
| 204 | (let* | ||
| 205 | ((date-form (if (equal (car (car d)) 'backup) | ||
| 206 | (cdr (car d)) | ||
| 207 | (car d))) | ||
| 208 | (backup (equal (car (car d)) 'backup)) | ||
| 209 | (dayname | ||
| 210 | (concat | ||
| 211 | (calendar-day-name gdate) "\\|" | ||
| 212 | (substring (calendar-day-name gdate) 0 3) ".?")) | ||
| 213 | (calendar-month-name-array | ||
| 214 | bahai-calendar-month-name-array) | ||
| 215 | (monthname | ||
| 216 | (concat | ||
| 217 | "\\*\\|" | ||
| 218 | (calendar-month-name month))) | ||
| 219 | (month (concat "\\*\\|0*" (int-to-string month))) | ||
| 220 | (day (concat "\\*\\|0*" (int-to-string day))) | ||
| 221 | (year | ||
| 222 | (concat | ||
| 223 | "\\*\\|0*" (int-to-string year) | ||
| 224 | (if abbreviated-calendar-year | ||
| 225 | (concat "\\|" (int-to-string (% year 100))) | ||
| 226 | ""))) | ||
| 227 | (regexp | ||
| 228 | (concat | ||
| 229 | "\\(\\`\\|\^M\\|\n\\)" mark "?" | ||
| 230 | (regexp-quote bahai-diary-entry-symbol) | ||
| 231 | "\\(" | ||
| 232 | (mapconcat 'eval date-form "\\)\\(") | ||
| 233 | "\\)")) | ||
| 234 | (case-fold-search t)) | ||
| 235 | (goto-char (point-min)) | ||
| 236 | (while (re-search-forward regexp nil t) | ||
| 237 | (if backup (re-search-backward "\\<" nil t)) | ||
| 238 | (if (and (or (char-equal (preceding-char) ?\^M) | ||
| 239 | (char-equal (preceding-char) ?\n)) | ||
| 240 | (not (looking-at " \\|\^I"))) | ||
| 241 | ;; Diary entry that consists only of date. | ||
| 242 | (backward-char 1) | ||
| 243 | ;; Found a nonempty diary entry--make it visible and | ||
| 244 | ;; add it to the list. | ||
| 245 | (let ((entry-start (point)) | ||
| 246 | (date-start)) | ||
| 247 | (re-search-backward "\^M\\|\n\\|\\`") | ||
| 248 | (setq date-start (point)) | ||
| 249 | (re-search-forward "\^M\\|\n" nil t 2) | ||
| 250 | (while (looking-at " \\|\^I") | ||
| 251 | (re-search-forward "\^M\\|\n" nil t)) | ||
| 252 | (backward-char 1) | ||
| 253 | (subst-char-in-region date-start (point) ?\^M ?\n t) | ||
| 254 | (add-to-diary-list | ||
| 255 | gdate | ||
| 256 | (buffer-substring-no-properties entry-start (point)) | ||
| 257 | (buffer-substring-no-properties | ||
| 258 | (1+ date-start) (1- entry-start))))))) | ||
| 259 | (setq d (cdr d)))) | ||
| 260 | (setq gdate | ||
| 261 | (calendar-gregorian-from-absolute | ||
| 262 | (1+ (calendar-absolute-from-gregorian gdate))))) | ||
| 263 | (set-buffer-modified-p diary-modified)) | ||
| 264 | (goto-char (point-min)))) | ||
| 265 | |||
| 266 | (defun mark-bahai-diary-entries () | ||
| 267 | "Mark days in the calendar window that have Baha'i date diary entries. | ||
| 268 | Each entry in diary-file (or included files) visible in the calendar | ||
| 269 | window is marked. Baha'i date entries are prefaced by a | ||
| 270 | bahai-diary-entry-symbol \(normally a B`I'). The same | ||
| 271 | diary-date-forms govern the style of the Baha'i calendar entries, | ||
| 272 | except that the Baha'i month names must be spelled in full. The | ||
| 273 | Baha'i months are numbered from 1 to 12 with Baha being 1 and 12 being | ||
| 274 | `Ala. Baha'i date diary entries that begin with a | ||
| 275 | diary-nonmarking-symbol will not be marked in the calendar. This | ||
| 276 | function is provided for use as part of the | ||
| 277 | nongregorian-diary-marking-hook." | ||
| 278 | (let ((d diary-date-forms)) | ||
| 279 | (while d | ||
| 280 | (let* | ||
| 281 | ((date-form (if (equal (car (car d)) 'backup) | ||
| 282 | (cdr (car d)) | ||
| 283 | (car d)));; ignore 'backup directive | ||
| 284 | (dayname (diary-name-pattern calendar-day-name-array)) | ||
| 285 | (monthname | ||
| 286 | (concat | ||
| 287 | (diary-name-pattern bahai-calendar-month-name-array t) | ||
| 288 | "\\|\\*")) | ||
| 289 | (month "[0-9]+\\|\\*") | ||
| 290 | (day "[0-9]+\\|\\*") | ||
| 291 | (year "[0-9]+\\|\\*") | ||
| 292 | (l (length date-form)) | ||
| 293 | (d-name-pos (- l (length (memq 'dayname date-form)))) | ||
| 294 | (d-name-pos (if (/= l d-name-pos) (+ 2 d-name-pos))) | ||
| 295 | (m-name-pos (- l (length (memq 'monthname date-form)))) | ||
| 296 | (m-name-pos (if (/= l m-name-pos) (+ 2 m-name-pos))) | ||
| 297 | (d-pos (- l (length (memq 'day date-form)))) | ||
| 298 | (d-pos (if (/= l d-pos) (+ 2 d-pos))) | ||
| 299 | (m-pos (- l (length (memq 'month date-form)))) | ||
| 300 | (m-pos (if (/= l m-pos) (+ 2 m-pos))) | ||
| 301 | (y-pos (- l (length (memq 'year date-form)))) | ||
| 302 | (y-pos (if (/= l y-pos) (+ 2 y-pos))) | ||
| 303 | (regexp | ||
| 304 | (concat | ||
| 305 | "\\(\\`\\|\^M\\|\n\\)" | ||
| 306 | (regexp-quote bahai-diary-entry-symbol) | ||
| 307 | "\\(" | ||
| 308 | (mapconcat 'eval date-form "\\)\\(") | ||
| 309 | "\\)")) | ||
| 310 | (case-fold-search t)) | ||
| 311 | (goto-char (point-min)) | ||
| 312 | (while (re-search-forward regexp nil t) | ||
| 313 | (let* ((dd-name | ||
| 314 | (if d-name-pos | ||
| 315 | (buffer-substring | ||
| 316 | (match-beginning d-name-pos) | ||
| 317 | (match-end d-name-pos)))) | ||
| 318 | (mm-name | ||
| 319 | (if m-name-pos | ||
| 320 | (buffer-substring | ||
| 321 | (match-beginning m-name-pos) | ||
| 322 | (match-end m-name-pos)))) | ||
| 323 | (mm (string-to-int | ||
| 324 | (if m-pos | ||
| 325 | (buffer-substring | ||
| 326 | (match-beginning m-pos) | ||
| 327 | (match-end m-pos)) | ||
| 328 | ""))) | ||
| 329 | (dd (string-to-int | ||
| 330 | (if d-pos | ||
| 331 | (buffer-substring | ||
| 332 | (match-beginning d-pos) | ||
| 333 | (match-end d-pos)) | ||
| 334 | ""))) | ||
| 335 | (y-str (if y-pos | ||
| 336 | (buffer-substring | ||
| 337 | (match-beginning y-pos) | ||
| 338 | (match-end y-pos)))) | ||
| 339 | (yy (if (not y-str) | ||
| 340 | 0 | ||
| 341 | (if (and (= (length y-str) 2) | ||
| 342 | abbreviated-calendar-year) | ||
| 343 | (let* ((current-y | ||
| 344 | (extract-calendar-year | ||
| 345 | (calendar-bahai-from-absolute | ||
| 346 | (calendar-absolute-from-gregorian | ||
| 347 | (calendar-current-date))))) | ||
| 348 | (y (+ (string-to-int y-str) | ||
| 349 | (* 100 (/ current-y 100))))) | ||
| 350 | (if (> (- y current-y) 50) | ||
| 351 | (- y 100) | ||
| 352 | (if (> (- current-y y) 50) | ||
| 353 | (+ y 100) | ||
| 354 | y))) | ||
| 355 | (string-to-int y-str))))) | ||
| 356 | (if dd-name | ||
| 357 | (mark-calendar-days-named | ||
| 358 | (cdr (assoc-ignore-case (substring dd-name 0 3) | ||
| 359 | (calendar-make-alist | ||
| 360 | calendar-day-name-array | ||
| 361 | 0 | ||
| 362 | '(lambda (x) (substring x 0 3)))))) | ||
| 363 | (if mm-name | ||
| 364 | (if (string-equal mm-name "*") | ||
| 365 | (setq mm 0) | ||
| 366 | (setq mm | ||
| 367 | (cdr (assoc-ignore-case | ||
| 368 | mm-name | ||
| 369 | (calendar-make-alist | ||
| 370 | bahai-calendar-month-name-array)))))) | ||
| 371 | (mark-bahai-calendar-date-pattern mm dd yy))))) | ||
| 372 | (setq d (cdr d))))) | ||
| 373 | |||
| 374 | (defun mark-bahai-calendar-date-pattern (month day year) | ||
| 375 | "Mark dates in calendar window that conform to Baha'i date MONTH/DAY/YEAR. | ||
| 376 | A value of 0 in any position is a wildcard." | ||
| 377 | (save-excursion | ||
| 378 | (set-buffer calendar-buffer) | ||
| 379 | (if (and (/= 0 month) (/= 0 day)) | ||
| 380 | (if (/= 0 year) | ||
| 381 | ;; Fully specified Baha'i date. | ||
| 382 | (let ((date (calendar-gregorian-from-absolute | ||
| 383 | (calendar-absolute-from-bahai | ||
| 384 | (list month day year))))) | ||
| 385 | (if (calendar-date-is-visible-p date) | ||
| 386 | (mark-visible-calendar-date date))) | ||
| 387 | ;; Month and day in any year--this taken from the holiday stuff. | ||
| 388 | (let* ((bahai-date (calendar-bahai-from-absolute | ||
| 389 | (calendar-absolute-from-gregorian | ||
| 390 | (list displayed-month 15 displayed-year)))) | ||
| 391 | (m (extract-calendar-month bahai-date)) | ||
| 392 | (y (extract-calendar-year bahai-date)) | ||
| 393 | (date)) | ||
| 394 | (if (< m 1) | ||
| 395 | nil;; Baha'i calendar doesn't apply. | ||
| 396 | (increment-calendar-month m y (- 10 month)) | ||
| 397 | (if (> m 7);; Baha'i date might be visible | ||
| 398 | (let ((date (calendar-gregorian-from-absolute | ||
| 399 | (calendar-absolute-from-bahai | ||
| 400 | (list month day y))))) | ||
| 401 | (if (calendar-date-is-visible-p date) | ||
| 402 | (mark-visible-calendar-date date))))))) | ||
| 403 | ;; Not one of the simple cases--check all visible dates for match. | ||
| 404 | ;; Actually, the following code takes care of ALL of the cases, but | ||
| 405 | ;; it's much too slow to be used for the simple (common) cases. | ||
| 406 | (let ((m displayed-month) | ||
| 407 | (y displayed-year) | ||
| 408 | (first-date) | ||
| 409 | (last-date)) | ||
| 410 | (increment-calendar-month m y -1) | ||
| 411 | (setq first-date | ||
| 412 | (calendar-absolute-from-gregorian | ||
| 413 | (list m 1 y))) | ||
| 414 | (increment-calendar-month m y 2) | ||
| 415 | (setq last-date | ||
| 416 | (calendar-absolute-from-gregorian | ||
| 417 | (list m (calendar-last-day-of-month m y) y))) | ||
| 418 | (calendar-for-loop date from first-date to last-date do | ||
| 419 | (let* ((b-date (calendar-bahai-from-absolute date)) | ||
| 420 | (i-month (extract-calendar-month b-date)) | ||
| 421 | (i-day (extract-calendar-day b-date)) | ||
| 422 | (i-year (extract-calendar-year b-date))) | ||
| 423 | (and (or (zerop month) | ||
| 424 | (= month i-month)) | ||
| 425 | (or (zerop day) | ||
| 426 | (= day i-day)) | ||
| 427 | (or (zerop year) | ||
| 428 | (= year i-year)) | ||
| 429 | (mark-visible-calendar-date | ||
| 430 | (calendar-gregorian-from-absolute date))))))))) | ||
| 431 | |||
| 432 | (defun insert-bahai-diary-entry (arg) | ||
| 433 | "Insert a diary entry. | ||
| 434 | For the Baha'i date corresponding to the date indicated by point. | ||
| 435 | Prefix arg will make the entry nonmarking." | ||
| 436 | (interactive "P") | ||
| 437 | (let* ((calendar-month-name-array bahai-calendar-month-name-array)) | ||
| 438 | (make-diary-entry | ||
| 439 | (concat | ||
| 440 | bahai-diary-entry-symbol | ||
| 441 | (calendar-date-string | ||
| 442 | (calendar-bahai-from-absolute | ||
| 443 | (calendar-absolute-from-gregorian | ||
| 444 | (calendar-cursor-to-date t))) | ||
| 445 | nil t)) | ||
| 446 | arg))) | ||
| 447 | |||
| 448 | (defun insert-monthly-bahai-diary-entry (arg) | ||
| 449 | "Insert a monthly diary entry. | ||
| 450 | For the day of the Baha'i month corresponding to the date indicated by point. | ||
| 451 | Prefix arg will make the entry nonmarking." | ||
| 452 | (interactive "P") | ||
| 453 | (let* ((calendar-date-display-form | ||
| 454 | (if european-calendar-style '(day " * ") '("* " day ))) | ||
| 455 | (calendar-month-name-array bahai-calendar-month-name-array)) | ||
| 456 | (make-diary-entry | ||
| 457 | (concat | ||
| 458 | bahai-diary-entry-symbol | ||
| 459 | (calendar-date-string | ||
| 460 | (calendar-bahai-from-absolute | ||
| 461 | (calendar-absolute-from-gregorian | ||
| 462 | (calendar-cursor-to-date t))))) | ||
| 463 | arg))) | ||
| 464 | |||
| 465 | (defun insert-yearly-bahai-diary-entry (arg) | ||
| 466 | "Insert an annual diary entry. | ||
| 467 | For the day of the Baha'i year corresponding to the date indicated by point. | ||
| 468 | Prefix arg will make the entry nonmarking." | ||
| 469 | (interactive "P") | ||
| 470 | (let* ((calendar-date-display-form | ||
| 471 | (if european-calendar-style | ||
| 472 | '(day " " monthname) | ||
| 473 | '(monthname " " day))) | ||
| 474 | (calendar-month-name-array bahai-calendar-month-name-array)) | ||
| 475 | (make-diary-entry | ||
| 476 | (concat | ||
| 477 | bahai-diary-entry-symbol | ||
| 478 | (calendar-date-string | ||
| 479 | (calendar-bahai-from-absolute | ||
| 480 | (calendar-absolute-from-gregorian | ||
| 481 | (calendar-cursor-to-date t))))) | ||
| 482 | arg))) | ||
| 483 | |||
| 484 | (provide 'cal-bahai) | ||
| 485 | |||
| 486 | ;;; cal-bahai.el ends here | ||
diff --git a/lisp/calendar/cal-menu.el b/lisp/calendar/cal-menu.el index 7c7056db7e7..51cdb157ad5 100644 --- a/lisp/calendar/cal-menu.el +++ b/lisp/calendar/cal-menu.el | |||
| @@ -63,6 +63,8 @@ | |||
| 63 | '("Insert Hebrew" . calendar-mouse-insert-hebrew-diary-entry)) | 63 | '("Insert Hebrew" . calendar-mouse-insert-hebrew-diary-entry)) |
| 64 | (define-key calendar-mode-map [menu-bar diary isl] | 64 | (define-key calendar-mode-map [menu-bar diary isl] |
| 65 | '("Insert Islamic" . calendar-mouse-insert-islamic-diary-entry)) | 65 | '("Insert Islamic" . calendar-mouse-insert-islamic-diary-entry)) |
| 66 | (define-key calendar-mode-map [menu-bar diary baha] | ||
| 67 | '("Insert Baha'i" . calendar-mouse-insert-bahai-diary-entry)) | ||
| 66 | (define-key calendar-mode-map [menu-bar diary cyc] | 68 | (define-key calendar-mode-map [menu-bar diary cyc] |
| 67 | '("Insert Cyclic" . insert-cyclic-diary-entry)) | 69 | '("Insert Cyclic" . insert-cyclic-diary-entry)) |
| 68 | (define-key calendar-mode-map [menu-bar diary blk] | 70 | (define-key calendar-mode-map [menu-bar diary blk] |
| @@ -107,6 +109,8 @@ | |||
| 107 | (define-key calendar-mode-map [menu-bar goto islamic] | 109 | (define-key calendar-mode-map [menu-bar goto islamic] |
| 108 | '("Islamic Date" . calendar-goto-islamic-date)) | 110 | '("Islamic Date" . calendar-goto-islamic-date)) |
| 109 | (define-key calendar-mode-map [menu-bar goto persian] | 111 | (define-key calendar-mode-map [menu-bar goto persian] |
| 112 | '("Baha'i Date" . calendar-goto-bahai-date)) | ||
| 113 | (define-key calendar-mode-map [menu-bar goto persian] | ||
| 110 | '("Persian Date" . calendar-goto-persian-date)) | 114 | '("Persian Date" . calendar-goto-persian-date)) |
| 111 | (define-key calendar-mode-map [menu-bar goto hebrew] | 115 | (define-key calendar-mode-map [menu-bar goto hebrew] |
| 112 | '("Hebrew Date" . calendar-goto-hebrew-date)) | 116 | '("Hebrew Date" . calendar-goto-hebrew-date)) |
| @@ -266,6 +270,19 @@ ERROR is t, otherwise just returns nil." | |||
| 266 | '("Yearly" . insert-yearly-islamic-diary-entry)))))) | 270 | '("Yearly" . insert-yearly-islamic-diary-entry)))))) |
| 267 | (and islamic-selection (call-interactively islamic-selection)))) | 271 | (and islamic-selection (call-interactively islamic-selection)))) |
| 268 | 272 | ||
| 273 | (defun calendar-mouse-insert-bahai-diary-entry (event) | ||
| 274 | "Pop up menu to insert an Baha'i-date diary entry." | ||
| 275 | (interactive "e") | ||
| 276 | (let ((bahai-selection | ||
| 277 | (x-popup-menu | ||
| 278 | event | ||
| 279 | (list "Baha'i insert menu" | ||
| 280 | (list (calendar-bahai-date-string (calendar-cursor-to-date)) | ||
| 281 | '("One time" . insert-bahai-diary-entry) | ||
| 282 | '("Monthly" . insert-monthly-bahai-diary-entry) | ||
| 283 | '("Yearly" . insert-yearly-bahai-diary-entry)))))) | ||
| 284 | (and bahai-selection (call-interactively bahai-selection)))) | ||
| 285 | |||
| 269 | (defun calendar-mouse-sunrise/sunset () | 286 | (defun calendar-mouse-sunrise/sunset () |
| 270 | "Show sunrise/sunset times for mouse-selected date." | 287 | "Show sunrise/sunset times for mouse-selected date." |
| 271 | (interactive) | 288 | (interactive) |
| @@ -474,7 +491,9 @@ The output is in landscape format, one month to a page." | |||
| 474 | (list (format "Hebrew date (before sunset): %s" | 491 | (list (format "Hebrew date (before sunset): %s" |
| 475 | (calendar-hebrew-date-string date))) | 492 | (calendar-hebrew-date-string date))) |
| 476 | (list (format "Persian date: %s" | 493 | (list (format "Persian date: %s" |
| 477 | (calendar-persian-date-string date)))) | 494 | (calendar-persian-date-string date))) |
| 495 | (list (format "Baha'i date (before sunset): %s" | ||
| 496 | (calendar-bahai-date-string date)))) | ||
| 478 | (let ((i (calendar-islamic-date-string date))) | 497 | (let ((i (calendar-islamic-date-string date))) |
| 479 | (if (not (string-equal i "")) | 498 | (if (not (string-equal i "")) |
| 480 | (list (list (format "Islamic date (before sunset): %s" i))))) | 499 | (list (list (format "Islamic date (before sunset): %s" i))))) |
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index 224e9376411..253ae38001f 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el | |||
| @@ -26,26 +26,29 @@ | |||
| 26 | 26 | ||
| 27 | ;;; Commentary: | 27 | ;;; Commentary: |
| 28 | 28 | ||
| 29 | ;; This collection of functions implements a calendar window. It generates a | 29 | ;; This collection of functions implements a calendar window. It |
| 30 | ;; calendar for the current month, together with the previous and coming | 30 | ;; generates a calendar for the current month, together with the |
| 31 | ;; months, or for any other three-month period. The calendar can be scrolled | 31 | ;; previous and coming months, or for any other three-month period. |
| 32 | ;; forward and backward in the window to show months in the past or future; | 32 | ;; The calendar can be scrolled forward and backward in the window to |
| 33 | ;; the cursor can move forward and backward by days, weeks, or months, making | 33 | ;; show months in the past or future; the cursor can move forward and |
| 34 | ;; it possible, for instance, to jump to the date a specified number of days, | 34 | ;; backward by days, weeks, or months, making it possible, for |
| 35 | ;; weeks, or months from the date under the cursor. The user can display a | 35 | ;; instance, to jump to the date a specified number of days, weeks, or |
| 36 | ;; list of holidays and other notable days for the period shown; the notable | 36 | ;; months from the date under the cursor. The user can display a list |
| 37 | ;; days can be marked on the calendar, if desired. The user can also specify | 37 | ;; of holidays and other notable days for the period shown; the |
| 38 | ;; that dates having corresponding diary entries (in a file that the user | 38 | ;; notable days can be marked on the calendar, if desired. The user |
| 39 | ;; specifies) be marked; the diary entries for any date can be viewed in a | 39 | ;; can also specify that dates having corresponding diary entries (in |
| 40 | ;; separate window. The diary and the notable days can be viewed | 40 | ;; a file that the user specifies) be marked; the diary entries for |
| 41 | ;; independently of the calendar. Dates can be translated from the (usual) | 41 | ;; any date can be viewed in a separate window. The diary and the |
| 42 | ;; Gregorian calendar to the day of the year/days remaining in year, to the | 42 | ;; notable days can be viewed independently of the calendar. Dates |
| 43 | ;; ISO commercial calendar, to the Julian (old style) calendar, to the Hebrew | 43 | ;; can be translated from the (usual) Gregorian calendar to the day of |
| 44 | ;; calendar, to the Islamic calendar, to the French Revolutionary calendar, to | 44 | ;; the year/days remaining in year, to the ISO commercial calendar, to |
| 45 | ;; the Mayan calendar, to the Chinese calendar, to the Coptic calendar, to the | 45 | ;; the Julian (old style) calendar, to the Hebrew calendar, to the |
| 46 | ;; Ethiopic calendar, and to the astronomical (Julian) day number. When | 46 | ;; Islamic calendar, to the Baha'i calendar, to the French |
| 47 | ;; floating point is available, times of sunrise/sunset can be displayed, as | 47 | ;; Revolutionary calendar, to the Mayan calendar, to the Chinese |
| 48 | ;; can the phases of the moon. Appointment notification for diary entries is | 48 | ;; calendar, to the Coptic calendar, to the Ethiopic calendar, and to |
| 49 | ;; the astronomical (Julian) day number. When floating point is | ||
| 50 | ;; available, times of sunrise/sunset can be displayed, as can the | ||
| 51 | ;; phases of the moon. Appointment notification for diary entries is | ||
| 49 | ;; available. Calendar printing via LaTeX is available. | 52 | ;; available. Calendar printing via LaTeX is available. |
| 50 | 53 | ||
| 51 | ;; The following files are part of the calendar/diary code: | 54 | ;; The following files are part of the calendar/diary code: |
| @@ -56,6 +59,7 @@ | |||
| 56 | ;; cal-dst.el Daylight savings time rules | 59 | ;; cal-dst.el Daylight savings time rules |
| 57 | ;; cal-hebrew.el Hebrew calendar | 60 | ;; cal-hebrew.el Hebrew calendar |
| 58 | ;; cal-islam.el Islamic calendar | 61 | ;; cal-islam.el Islamic calendar |
| 62 | ;; cal-bahai.el Baha'i calendar | ||
| 59 | ;; cal-iso.el ISO calendar | 63 | ;; cal-iso.el ISO calendar |
| 60 | ;; cal-julian.el Julian/astronomical calendars | 64 | ;; cal-julian.el Julian/astronomical calendars |
| 61 | ;; cal-mayan.el Mayan calendars | 65 | ;; cal-mayan.el Mayan calendars |
| @@ -306,6 +310,16 @@ calendar." | |||
| 306 | :group 'holidays) | 310 | :group 'holidays) |
| 307 | 311 | ||
| 308 | ;;;###autoload | 312 | ;;;###autoload |
| 313 | (defcustom all-bahai-calendar-holidays nil | ||
| 314 | "*If nil, show only major holidays from the Baha'i calendar. | ||
| 315 | These are the days on which work and school must be suspended. | ||
| 316 | |||
| 317 | If t, show all the holidays that would appear in a complete Baha'i | ||
| 318 | calendar." | ||
| 319 | :type 'boolean | ||
| 320 | :group 'holidays) | ||
| 321 | |||
| 322 | ;;;###autoload | ||
| 309 | (defcustom calendar-load-hook nil | 323 | (defcustom calendar-load-hook nil |
| 310 | "*List of functions to be called after the calendar is first loaded. | 324 | "*List of functions to be called after the calendar is first loaded. |
| 311 | This is the place to add key bindings to `calendar-mode-map'." | 325 | This is the place to add key bindings to `calendar-mode-map'." |
| @@ -446,21 +460,23 @@ Diary entries can be based on Lisp sexps. For example, the diary entry | |||
| 446 | 460 | ||
| 447 | %%(diary-block 11 1 1990 11 10 1990) Vacation | 461 | %%(diary-block 11 1 1990 11 10 1990) Vacation |
| 448 | 462 | ||
| 449 | causes the diary entry \"Vacation\" to appear from November 1 through November | 463 | causes the diary entry \"Vacation\" to appear from November 1 through |
| 450 | 10, 1990. Other functions available are `diary-float', `diary-anniversary', | 464 | November 10, 1990. Other functions available are `diary-float', |
| 451 | `diary-cyclic', `diary-day-of-year', `diary-iso-date', `diary-french-date', | 465 | `diary-anniversary', `diary-cyclic', `diary-day-of-year', |
| 452 | `diary-hebrew-date', `diary-islamic-date', `diary-mayan-date', | 466 | `diary-iso-date', `diary-french-date', `diary-hebrew-date', |
| 467 | `diary-islamic-date', `diary-bahai-date', `diary-mayan-date', | ||
| 453 | `diary-chinese-date', `diary-coptic-date', `diary-ethiopic-date', | 468 | `diary-chinese-date', `diary-coptic-date', `diary-ethiopic-date', |
| 454 | `diary-persian-date', `diary-yahrzeit', `diary-sunrise-sunset', | 469 | `diary-persian-date', `diary-yahrzeit', `diary-sunrise-sunset', |
| 455 | `diary-phases-of-moon', `diary-parasha', `diary-omer', `diary-rosh-hodesh', | 470 | `diary-phases-of-moon', `diary-parasha', `diary-omer', |
| 456 | and `diary-sabbath-candles'. See the documentation for the function | 471 | `diary-rosh-hodesh', and `diary-sabbath-candles'. See the |
| 457 | `list-sexp-diary-entries' for more details. | 472 | documentation for the function `list-sexp-diary-entries' for more |
| 473 | details. | ||
| 458 | 474 | ||
| 459 | Diary entries based on the Hebrew and/or the Islamic calendar are also | 475 | Diary entries based on the Hebrew, the Islamic and/or the Baha'i |
| 460 | possible, but because these are somewhat slow, they are ignored | 476 | calendar are also possible, but because these are somewhat slow, they |
| 461 | unless you set the `nongregorian-diary-listing-hook' and the | 477 | are ignored unless you set the `nongregorian-diary-listing-hook' and |
| 462 | `nongregorian-diary-marking-hook' appropriately. See the documentation | 478 | the `nongregorian-diary-marking-hook' appropriately. See the |
| 463 | for these functions for details. | 479 | documentation for these functions for details. |
| 464 | 480 | ||
| 465 | Diary files can contain directives to include the contents of other files; for | 481 | Diary files can contain directives to include the contents of other files; for |
| 466 | details, see the documentation for the variable `list-diary-entries-hook'." | 482 | details, see the documentation for the variable `list-diary-entries-hook'." |
| @@ -486,6 +502,12 @@ details, see the documentation for the variable `list-diary-entries-hook'." | |||
| 486 | :group 'diary) | 502 | :group 'diary) |
| 487 | 503 | ||
| 488 | ;;;###autoload | 504 | ;;;###autoload |
| 505 | (defcustom bahai-diary-entry-symbol "B" | ||
| 506 | "*Symbol indicating a diary entry according to the Baha'i calendar." | ||
| 507 | :type 'string | ||
| 508 | :group 'diary) | ||
| 509 | |||
| 510 | ;;;###autoload | ||
| 489 | (defcustom diary-include-string "#include" | 511 | (defcustom diary-include-string "#include" |
| 490 | "*The string indicating inclusion of another file of diary entries. | 512 | "*The string indicating inclusion of another file of diary entries. |
| 491 | See the documentation for the function `include-other-diary-files'." | 513 | See the documentation for the function `include-other-diary-files'." |
| @@ -502,8 +524,9 @@ See the documentation for the function `list-sexp-diary-entries'." | |||
| 502 | ;;;###autoload | 524 | ;;;###autoload |
| 503 | (defcustom abbreviated-calendar-year t | 525 | (defcustom abbreviated-calendar-year t |
| 504 | "*Interpret a two-digit year DD in a diary entry as either 19DD or 20DD. | 526 | "*Interpret a two-digit year DD in a diary entry as either 19DD or 20DD. |
| 505 | For the Gregorian calendar; similarly for the Hebrew and Islamic calendars. | 527 | For the Gregorian calendar; similarly for the Hebrew, Islamic and |
| 506 | If this variable is nil, years must be written in full." | 528 | Baha'i calendars. If this variable is nil, years must be written in |
| 529 | full." | ||
| 507 | :type 'boolean | 530 | :type 'boolean |
| 508 | :group 'diary) | 531 | :group 'diary) |
| 509 | 532 | ||
| @@ -735,11 +758,15 @@ diary buffer, set the variable `diary-list-include-blanks' to t." | |||
| 735 | ;;;###autoload | 758 | ;;;###autoload |
| 736 | (defcustom nongregorian-diary-listing-hook nil | 759 | (defcustom nongregorian-diary-listing-hook nil |
| 737 | "*List of functions called for listing diary file and included files. | 760 | "*List of functions called for listing diary file and included files. |
| 738 | As the files are processed for diary entries, these functions are used to cull | 761 | As the files are processed for diary entries, these functions are used |
| 739 | relevant entries. You can use either or both of `list-hebrew-diary-entries' | 762 | to cull relevant entries. You can use either or both of |
| 740 | and `list-islamic-diary-entries'. The documentation for these functions | 763 | `list-hebrew-diary-entries', `list-islamic-diary-entries' and |
| 764 | `list-bahai-diary-entries'. The documentation for these functions | ||
| 741 | describes the style of such diary entries." | 765 | describes the style of such diary entries." |
| 742 | :type 'hook | 766 | :type 'hook |
| 767 | :options '(list-hebrew-diary-entries | ||
| 768 | list-islamic-diary-entries | ||
| 769 | list-bahai-diary-entries) | ||
| 743 | :group 'diary) | 770 | :group 'diary) |
| 744 | 771 | ||
| 745 | ;;;###autoload | 772 | ;;;###autoload |
| @@ -762,11 +789,15 @@ function `include-other-diary-files' as part of `list-diary-entries-hook'." | |||
| 762 | ;;;###autoload | 789 | ;;;###autoload |
| 763 | (defcustom nongregorian-diary-marking-hook nil | 790 | (defcustom nongregorian-diary-marking-hook nil |
| 764 | "*List of functions called for marking diary file and included files. | 791 | "*List of functions called for marking diary file and included files. |
| 765 | As the files are processed for diary entries, these functions are used to cull | 792 | As the files are processed for diary entries, these functions are used |
| 766 | relevant entries. You can use either or both of `mark-hebrew-diary-entries' | 793 | to cull relevant entries. You can use either or both of |
| 767 | and `mark-islamic-diary-entries'. The documentation for these functions | 794 | `mark-hebrew-diary-entries', `mark-islamic-diary-entries' and |
| 795 | `mark-bahai-diary-entries'. The documentation for these functions | ||
| 768 | describes the style of such diary entries." | 796 | describes the style of such diary entries." |
| 769 | :type 'hook | 797 | :type 'hook |
| 798 | :options '(mark-hebrew-diary-entries | ||
| 799 | mark-islamic-diary-entries | ||
| 800 | mark-bahai-diary-entries) | ||
| 770 | :group 'diary) | 801 | :group 'diary) |
| 771 | 802 | ||
| 772 | ;;;###autoload | 803 | ;;;###autoload |
| @@ -1004,6 +1035,48 @@ See the documentation for `calendar-holidays' for details." | |||
| 1004 | :group 'holidays) | 1035 | :group 'holidays) |
| 1005 | 1036 | ||
| 1006 | ;;;###autoload | 1037 | ;;;###autoload |
| 1038 | (put 'bahai-holidays 'risky-local-variable t) | ||
| 1039 | ;;;###autoload | ||
| 1040 | (defcustom bahai-holidays | ||
| 1041 | '((holiday-fixed | ||
| 1042 | 3 21 | ||
| 1043 | (format "Baha'i New Year (Naw-Ruz) %d" (- displayed-year (1- 1844)))) | ||
| 1044 | (holiday-fixed 4 21 "First Day of Ridvan") | ||
| 1045 | (if all-bahai-calendar-holidays | ||
| 1046 | (holiday-fixed 4 22 "Second Day of Ridvan")) | ||
| 1047 | (if all-bahai-calendar-holidays | ||
| 1048 | (holiday-fixed 4 23 "Third Day of Ridvan")) | ||
| 1049 | (if all-bahai-calendar-holidays | ||
| 1050 | (holiday-fixed 4 24 "Fourth Day of Ridvan")) | ||
| 1051 | (if all-bahai-calendar-holidays | ||
| 1052 | (holiday-fixed 4 25 "Fifth Day of Ridvan")) | ||
| 1053 | (if all-bahai-calendar-holidays | ||
| 1054 | (holiday-fixed 4 26 "Sixth Day of Ridvan")) | ||
| 1055 | (if all-bahai-calendar-holidays | ||
| 1056 | (holiday-fixed 4 27 "Seventh Day of Ridvan")) | ||
| 1057 | (if all-bahai-calendar-holidays | ||
| 1058 | (holiday-fixed 4 28 "Eighth Day of Ridvan")) | ||
| 1059 | (holiday-fixed 4 29 "Ninth Day of Ridvan") | ||
| 1060 | (if all-bahai-calendar-holidays | ||
| 1061 | (holiday-fixed 4 30 "Tenth Day of Ridvan")) | ||
| 1062 | (if all-bahai-calendar-holidays | ||
| 1063 | (holiday-fixed 5 1 "Eleventh Day of Ridvan")) | ||
| 1064 | (holiday-fixed 5 2 "Twelfth Day of Ridvan") | ||
| 1065 | (holiday-fixed 5 23 "Declaration of the Bab") | ||
| 1066 | (holiday-fixed 5 29 "Ascension of Baha'u'llah") | ||
| 1067 | (holiday-fixed 7 9 "Martyrdom of the Bab") | ||
| 1068 | (holiday-fixed 10 20 "Birth of the Bab") | ||
| 1069 | (holiday-fixed 11 12 "Birth of Baha'u'llah") | ||
| 1070 | (if all-bahai-calendar-holidays | ||
| 1071 | (holiday-fixed 11 26 "Day of the Covenant")) | ||
| 1072 | (if all-bahai-calendar-holidays | ||
| 1073 | (holiday-fixed 11 28 "Ascension of `Abdu'l-Baha"))) | ||
| 1074 | "*Baha'i holidays. | ||
| 1075 | See the documentation for `calendar-holidays' for details." | ||
| 1076 | :type 'sexp | ||
| 1077 | :group 'holidays) | ||
| 1078 | |||
| 1079 | ;;;###autoload | ||
| 1007 | (put 'solar-holidays 'risky-local-variable t) | 1080 | (put 'solar-holidays 'risky-local-variable t) |
| 1008 | ;;;###autoload | 1081 | ;;;###autoload |
| 1009 | (defcustom solar-holidays | 1082 | (defcustom solar-holidays |
| @@ -1040,15 +1113,16 @@ See the documentation for `calendar-holidays' for details." | |||
| 1040 | (defcustom calendar-holidays | 1113 | (defcustom calendar-holidays |
| 1041 | (append general-holidays local-holidays other-holidays | 1114 | (append general-holidays local-holidays other-holidays |
| 1042 | christian-holidays hebrew-holidays islamic-holidays | 1115 | christian-holidays hebrew-holidays islamic-holidays |
| 1043 | oriental-holidays solar-holidays) | 1116 | bahai-holidays oriental-holidays solar-holidays) |
| 1044 | "*List of notable days for the command \\[holidays]. | 1117 | "*List of notable days for the command \\[holidays]. |
| 1045 | 1118 | ||
| 1046 | Additional holidays are easy to add to the list, just put them in the list | 1119 | Additional holidays are easy to add to the list, just put them in the |
| 1047 | `other-holidays' in your .emacs file. Similarly, by setting any of | 1120 | list `other-holidays' in your .emacs file. Similarly, by setting any |
| 1048 | `general-holidays', `local-holidays' `christian-holidays', `hebrew-holidays', | 1121 | of `general-holidays', `local-holidays' `christian-holidays', |
| 1049 | `islamic-holidays', `oriental-holidays', or `solar-holidays' to nil in your | 1122 | `hebrew-holidays', `islamic-holidays', `bahai-holidays', |
| 1050 | .emacs file, you can eliminate unwanted categories of holidays. The intention | 1123 | `oriental-holidays', or `solar-holidays' to nil in your .emacs file, |
| 1051 | is that (in the US) `local-holidays' be set in site-init.el and | 1124 | you can eliminate unwanted categories of holidays. The intention is |
| 1125 | that (in the US) `local-holidays' be set in site-init.el and | ||
| 1052 | `other-holidays' be set by the user. | 1126 | `other-holidays' be set by the user. |
| 1053 | 1127 | ||
| 1054 | Entries on the list are expressions that return (possibly empty) lists of | 1128 | Entries on the list are expressions that return (possibly empty) lists of |
| @@ -1064,6 +1138,7 @@ Several basic functions are provided for this purpose: | |||
| 1064 | DAYNAME after/before MONTH DAY. | 1138 | DAYNAME after/before MONTH DAY. |
| 1065 | (holiday-hebrew MONTH DAY STRING) a fixed date on the Hebrew calendar | 1139 | (holiday-hebrew MONTH DAY STRING) a fixed date on the Hebrew calendar |
| 1066 | (holiday-islamic MONTH DAY STRING) a fixed date on the Islamic calendar | 1140 | (holiday-islamic MONTH DAY STRING) a fixed date on the Islamic calendar |
| 1141 | (holiday-bahai MONTH DAY STRING) a fixed date on the Baha'i calendar | ||
| 1067 | (holiday-julian MONTH DAY STRING) a fixed date on the Julian calendar | 1142 | (holiday-julian MONTH DAY STRING) a fixed date on the Julian calendar |
| 1068 | (holiday-sexp SEXP STRING) SEXP is a Gregorian-date-valued expression | 1143 | (holiday-sexp SEXP STRING) SEXP is a Gregorian-date-valued expression |
| 1069 | in the variable `year'; if it evaluates to | 1144 | in the variable `year'; if it evaluates to |
| @@ -1091,6 +1166,11 @@ add the Islamic feast celebrating Mohammed's birthday use | |||
| 1091 | (holiday-islamic 3 12 \"Mohammed's Birthday\") | 1166 | (holiday-islamic 3 12 \"Mohammed's Birthday\") |
| 1092 | 1167 | ||
| 1093 | since the Islamic months are numbered from 1 starting with Muharram. To | 1168 | since the Islamic months are numbered from 1 starting with Muharram. To |
| 1169 | add an entry for the Baha'i festival of Ridvan, use | ||
| 1170 | |||
| 1171 | (holiday-bahai 2 13 \"Festival of Ridvan\") | ||
| 1172 | |||
| 1173 | since the Baha'i months are numbered from 1 starting with Baha. To | ||
| 1094 | add Thomas Jefferson's birthday, April 2, 1743 (Julian), use | 1174 | add Thomas Jefferson's birthday, April 2, 1743 (Julian), use |
| 1095 | 1175 | ||
| 1096 | (holiday-julian 4 2 \"Jefferson's Birthday\") | 1176 | (holiday-julian 4 2 \"Jefferson's Birthday\") |
| @@ -1570,6 +1650,14 @@ Driven by the variable `calendar-date-display-form'.") | |||
| 1570 | "String of Islamic date of Gregorian date." | 1650 | "String of Islamic date of Gregorian date." |
| 1571 | t) | 1651 | t) |
| 1572 | 1652 | ||
| 1653 | (autoload 'calendar-print-bahai-date "cal-bahai" | ||
| 1654 | "Show the Baha'i date equivalents of date." | ||
| 1655 | t) | ||
| 1656 | |||
| 1657 | (autoload 'calendar-bahai-date-string "cal-bahai" | ||
| 1658 | "String of Baha'i date of Gregorian date." | ||
| 1659 | t) | ||
| 1660 | |||
| 1573 | (autoload 'calendar-goto-hebrew-date "cal-hebrew" | 1661 | (autoload 'calendar-goto-hebrew-date "cal-hebrew" |
| 1574 | "Move cursor to Hebrew date date." | 1662 | "Move cursor to Hebrew date date." |
| 1575 | t) | 1663 | t) |
| @@ -1693,6 +1781,21 @@ to the date indicated by point." | |||
| 1693 | to the date indicated by point." | 1781 | to the date indicated by point." |
| 1694 | t) | 1782 | t) |
| 1695 | 1783 | ||
| 1784 | (autoload 'insert-bahai-diary-entry "cal-bahai" | ||
| 1785 | "Insert a diary entry for the Baha'i date corresponding to the date | ||
| 1786 | indicated by point." | ||
| 1787 | t) | ||
| 1788 | |||
| 1789 | (autoload 'insert-monthly-bahai-diary-entry "cal-bahai" | ||
| 1790 | "Insert a monthly diary entry for the day of the Baha'i month corresponding | ||
| 1791 | to the date indicated by point." | ||
| 1792 | t) | ||
| 1793 | |||
| 1794 | (autoload 'insert-yearly-bahai-diary-entry "cal-bahai" | ||
| 1795 | "Insert an annual diary entry for the day of the Baha'i year corresponding | ||
| 1796 | to the date indicated by point." | ||
| 1797 | t) | ||
| 1798 | |||
| 1696 | (autoload 'list-calendar-holidays "holidays" | 1799 | (autoload 'list-calendar-holidays "holidays" |
| 1697 | "Create a buffer containing the holidays for the current calendar window. | 1800 | "Create a buffer containing the holidays for the current calendar window. |
| 1698 | The holidays are those in the list `calendar-notable-days'. Returns t if any | 1801 | The holidays are those in the list `calendar-notable-days'. Returns t if any |
| @@ -1940,6 +2043,7 @@ the inserted text. Value is always t." | |||
| 1940 | (define-key calendar-mode-map "ga" 'calendar-goto-astro-day-number) | 2043 | (define-key calendar-mode-map "ga" 'calendar-goto-astro-day-number) |
| 1941 | (define-key calendar-mode-map "gh" 'calendar-goto-hebrew-date) | 2044 | (define-key calendar-mode-map "gh" 'calendar-goto-hebrew-date) |
| 1942 | (define-key calendar-mode-map "gi" 'calendar-goto-islamic-date) | 2045 | (define-key calendar-mode-map "gi" 'calendar-goto-islamic-date) |
| 2046 | (define-key calendar-mode-map "gb" 'calendar-goto-bahai-date) | ||
| 1943 | (define-key calendar-mode-map "gC" 'calendar-goto-chinese-date) | 2047 | (define-key calendar-mode-map "gC" 'calendar-goto-chinese-date) |
| 1944 | (define-key calendar-mode-map "gk" 'calendar-goto-coptic-date) | 2048 | (define-key calendar-mode-map "gk" 'calendar-goto-coptic-date) |
| 1945 | (define-key calendar-mode-map "ge" 'calendar-goto-ethiopic-date) | 2049 | (define-key calendar-mode-map "ge" 'calendar-goto-ethiopic-date) |
| @@ -1980,6 +2084,7 @@ the inserted text. Value is always t." | |||
| 1980 | (define-key calendar-mode-map "pa" 'calendar-print-astro-day-number) | 2084 | (define-key calendar-mode-map "pa" 'calendar-print-astro-day-number) |
| 1981 | (define-key calendar-mode-map "ph" 'calendar-print-hebrew-date) | 2085 | (define-key calendar-mode-map "ph" 'calendar-print-hebrew-date) |
| 1982 | (define-key calendar-mode-map "pi" 'calendar-print-islamic-date) | 2086 | (define-key calendar-mode-map "pi" 'calendar-print-islamic-date) |
| 2087 | (define-key calendar-mode-map "pb" 'calendar-print-bahai-date) | ||
| 1983 | (define-key calendar-mode-map "pf" 'calendar-print-french-date) | 2088 | (define-key calendar-mode-map "pf" 'calendar-print-french-date) |
| 1984 | (define-key calendar-mode-map "pm" 'calendar-print-mayan-date) | 2089 | (define-key calendar-mode-map "pm" 'calendar-print-mayan-date) |
| 1985 | (define-key calendar-mode-map "po" 'calendar-print-other-dates) | 2090 | (define-key calendar-mode-map "po" 'calendar-print-other-dates) |
| @@ -1996,6 +2101,9 @@ the inserted text. Value is always t." | |||
| 1996 | (define-key calendar-mode-map "iid" 'insert-islamic-diary-entry) | 2101 | (define-key calendar-mode-map "iid" 'insert-islamic-diary-entry) |
| 1997 | (define-key calendar-mode-map "iim" 'insert-monthly-islamic-diary-entry) | 2102 | (define-key calendar-mode-map "iim" 'insert-monthly-islamic-diary-entry) |
| 1998 | (define-key calendar-mode-map "iiy" 'insert-yearly-islamic-diary-entry) | 2103 | (define-key calendar-mode-map "iiy" 'insert-yearly-islamic-diary-entry) |
| 2104 | (define-key calendar-mode-map "iBd" 'insert-bahai-diary-entry) | ||
| 2105 | (define-key calendar-mode-map "iBm" 'insert-monthly-bahai-diary-entry) | ||
| 2106 | (define-key calendar-mode-map "iBy" 'insert-yearly-bahai-diary-entry) | ||
| 1999 | (define-key calendar-mode-map "?" 'calendar-goto-info-node) | 2107 | (define-key calendar-mode-map "?" 'calendar-goto-info-node) |
| 2000 | (define-key calendar-mode-map "tm" 'cal-tex-cursor-month) | 2108 | (define-key calendar-mode-map "tm" 'cal-tex-cursor-month) |
| 2001 | (define-key calendar-mode-map "tM" 'cal-tex-cursor-month-landscape) | 2109 | (define-key calendar-mode-map "tM" 'cal-tex-cursor-month-landscape) |
| @@ -2614,6 +2722,9 @@ Defaults to today's date if DATE is not given." | |||
| 2614 | (let ((i (calendar-islamic-date-string date))) | 2722 | (let ((i (calendar-islamic-date-string date))) |
| 2615 | (if (not (string-equal i "")) | 2723 | (if (not (string-equal i "")) |
| 2616 | (format "Islamic date (before sunset): %s" i))) | 2724 | (format "Islamic date (before sunset): %s" i))) |
| 2725 | (let ((b (calendar-bahai-date-string date))) | ||
| 2726 | (if (not (string-equal b "")) | ||
| 2727 | (format "Baha'i date (before sunset): %s" b))) | ||
| 2617 | (format "Chinese date: %s" | 2728 | (format "Chinese date: %s" |
| 2618 | (calendar-chinese-date-string date)) | 2729 | (calendar-chinese-date-string date)) |
| 2619 | (let ((c (calendar-coptic-date-string date))) | 2730 | (let ((c (calendar-coptic-date-string date))) |
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index c03b92a73d1..084b2881747 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el | |||
| @@ -136,6 +136,22 @@ The holidays are those in the list `calendar-holidays'." | |||
| 136 | "Mark dates in calendar window that conform to Islamic date MONTH/DAY/YEAR." | 136 | "Mark dates in calendar window that conform to Islamic date MONTH/DAY/YEAR." |
| 137 | t) | 137 | t) |
| 138 | 138 | ||
| 139 | (autoload 'diary-bahai-date "cal-bahai" | ||
| 140 | "Baha'i calendar equivalent of date diary entry." | ||
| 141 | t) | ||
| 142 | |||
| 143 | (autoload 'list-bahai-diary-entries "cal-bahai" | ||
| 144 | "Add any Baha'i date entries from the diary file to `diary-entries-list'." | ||
| 145 | t) | ||
| 146 | |||
| 147 | (autoload 'mark-bahai-diary-entries "cal-bahai" | ||
| 148 | "Mark days in the calendar window that have Baha'i date diary entries." | ||
| 149 | t) | ||
| 150 | |||
| 151 | (autoload 'mark-bahai-calendar-date-pattern "cal-bahai" | ||
| 152 | "Mark dates in calendar window that conform to Baha'i date MONTH/DAY/YEAR." | ||
| 153 | t) | ||
| 154 | |||
| 139 | (autoload 'diary-hebrew-date "cal-hebrew" | 155 | (autoload 'diary-hebrew-date "cal-hebrew" |
| 140 | "Hebrew calendar equivalent of date diary entry." | 156 | "Hebrew calendar equivalent of date diary entry." |
| 141 | t) | 157 | t) |
diff --git a/lisp/calendar/holidays.el b/lisp/calendar/holidays.el index f8b3d0cd9d6..f535305635c 100644 --- a/lisp/calendar/holidays.el +++ b/lisp/calendar/holidays.el | |||
| @@ -81,6 +81,10 @@ | |||
| 81 | "Holiday on MONTH, DAY (Islamic) called STRING." | 81 | "Holiday on MONTH, DAY (Islamic) called STRING." |
| 82 | t) | 82 | t) |
| 83 | 83 | ||
| 84 | (autoload 'holiday-bahai "cal-bahai" | ||
| 85 | "Holiday on MONTH, DAY (Baha'i) called STRING." | ||
| 86 | t) | ||
| 87 | |||
| 84 | (autoload 'holiday-chinese-new-year "cal-china" | 88 | (autoload 'holiday-chinese-new-year "cal-china" |
| 85 | "Date of Chinese New Year." | 89 | "Date of Chinese New Year." |
| 86 | t) | 90 | t) |
| @@ -137,6 +141,7 @@ The optional LABEL is used to label the buffer created." | |||
| 137 | (if christian-holidays (cons "Christian" christian-holidays)) | 141 | (if christian-holidays (cons "Christian" christian-holidays)) |
| 138 | (if hebrew-holidays (cons "Hebrew" hebrew-holidays)) | 142 | (if hebrew-holidays (cons "Hebrew" hebrew-holidays)) |
| 139 | (if islamic-holidays (cons "Islamic" islamic-holidays)) | 143 | (if islamic-holidays (cons "Islamic" islamic-holidays)) |
| 144 | (if bahai-holidays (cons "Baha'i" bahai-holidays)) | ||
| 140 | (if oriental-holidays (cons "Oriental" oriental-holidays)) | 145 | (if oriental-holidays (cons "Oriental" oriental-holidays)) |
| 141 | (if solar-holidays (cons "Solar" solar-holidays)) | 146 | (if solar-holidays (cons "Solar" solar-holidays)) |
| 142 | (cons "Ask" nil))) | 147 | (cons "Ask" nil))) |
diff --git a/lisp/pcvs-util.el b/lisp/pcvs-util.el index 89506ecd7c8..b3fea977636 100644 --- a/lisp/pcvs-util.el +++ b/lisp/pcvs-util.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | ;; Author: Stefan Monnier <monnier@cs.yale.edu> | 6 | ;; Author: Stefan Monnier <monnier@cs.yale.edu> |
| 7 | ;; Keywords: pcl-cvs | 7 | ;; Keywords: pcl-cvs |
| 8 | ;; Revision: $Id: pcvs-util.el,v 1.9 2001/01/09 13:12:04 gerd Exp $ | 8 | ;; Revision: $Id: pcvs-util.el,v 1.10 2001/03/07 00:19:08 monnier Exp $ |
| 9 | 9 | ||
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| 11 | 11 | ||
| @@ -125,7 +125,7 @@ BUF is assumed to be a temporary buffer used from the buffer MAINBUF." | |||
| 125 | (if (and mainbuf (get-buffer-window mainbuf)) | 125 | (if (and mainbuf (get-buffer-window mainbuf)) |
| 126 | ;; FIXME: if the buffer popped into a pre-existing window, | 126 | ;; FIXME: if the buffer popped into a pre-existing window, |
| 127 | ;; we don't want to delete that window. | 127 | ;; we don't want to delete that window. |
| 128 | ;;(delete-window win) | 128 | t ;;(delete-window win) |
| 129 | )))) | 129 | )))) |
| 130 | (with-current-buffer buf | 130 | (with-current-buffer buf |
| 131 | (bury-buffer (unless (and (eq buf (window-buffer (selected-window))) | 131 | (bury-buffer (unless (and (eq buf (window-buffer (selected-window))) |