diff options
| -rw-r--r-- | lisp/ChangeLog | 3 | ||||
| -rw-r--r-- | lisp/calendar/cal-bahai.el | 30 |
2 files changed, 18 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8e1b336016b..cefb061a5e6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -37,6 +37,9 @@ | |||
| 37 | (french-calendar-day-name-array, french-calendar-special-days-array): | 37 | (french-calendar-day-name-array, french-calendar-special-days-array): |
| 38 | Add doc strings. | 38 | Add doc strings. |
| 39 | 39 | ||
| 40 | * calendar/cal-bahai.el (diary-bahai-mark-entries) | ||
| 41 | (diary-bahai-insert-entry, diary-bahai-insert-monthly-entry) | ||
| 42 | (diary-bahai-insert-yearly-entry): | ||
| 40 | * calendar/cal-dst.el (calendar-next-time-zone-transition) | 43 | * calendar/cal-dst.el (calendar-next-time-zone-transition) |
| 41 | (calendar-time-zone): | 44 | (calendar-time-zone): |
| 42 | * calendar/cal-islam.el (islamic-calendar-leap-year-p) | 45 | * calendar/cal-islam.el (islamic-calendar-leap-year-p) |
diff --git a/lisp/calendar/cal-bahai.el b/lisp/calendar/cal-bahai.el index 15688e9e834..6263cb9bd92 100644 --- a/lisp/calendar/cal-bahai.el +++ b/lisp/calendar/cal-bahai.el | |||
| @@ -86,34 +86,34 @@ Gregorian date Sunday, December 31, 1 BC." | |||
| 86 | (day (extract-calendar-day date)) | 86 | (day (extract-calendar-day date)) |
| 87 | (year (extract-calendar-year date)) | 87 | (year (extract-calendar-year date)) |
| 88 | (prior-years (+ (1- year) 1844)) | 88 | (prior-years (+ (1- year) 1844)) |
| 89 | (leap-days (- (+ (/ prior-years 4) ; Leap days in prior years. | 89 | (leap-days (- (+ (/ prior-years 4) ; leap days in prior years |
| 90 | (- (/ prior-years 100)) | 90 | (- (/ prior-years 100)) |
| 91 | (/ prior-years 400)) | 91 | (/ prior-years 400)) |
| 92 | calendar-bahai-leap-base))) | 92 | calendar-bahai-leap-base))) |
| 93 | (+ (1- calendar-bahai-epoch) ; Days before epoch | 93 | (+ (1- calendar-bahai-epoch) ; days before epoch |
| 94 | (* 365 (1- year)) ; Days in prior years. | 94 | (* 365 (1- year)) ; days in prior years |
| 95 | leap-days | 95 | leap-days |
| 96 | (calendar-sum m 1 (< m month) 19) | 96 | (calendar-sum m 1 (< m month) 19) |
| 97 | (if (= month 19) 4 0) | 97 | (if (= month 19) 4 0) |
| 98 | day))) ; Days so far this month. | 98 | day))) ; days so far this month |
| 99 | 99 | ||
| 100 | (defun calendar-bahai-from-absolute (date) | 100 | (defun calendar-bahai-from-absolute (date) |
| 101 | "Bahá'í year corresponding to the absolute DATE." | 101 | "Bahá'í year corresponding to the absolute DATE." |
| 102 | (if (< date calendar-bahai-epoch) | 102 | (if (< date calendar-bahai-epoch) |
| 103 | (list 0 0 0) ;; pre-Bahá'í date | 103 | (list 0 0 0) ; pre-Bahá'í date |
| 104 | (let* ((greg (calendar-gregorian-from-absolute date)) | 104 | (let* ((greg (calendar-gregorian-from-absolute date)) |
| 105 | (year (+ (- (extract-calendar-year greg) 1844) | 105 | (year (+ (- (extract-calendar-year greg) 1844) |
| 106 | (if (or (> (extract-calendar-month greg) 3) | 106 | (if (or (> (extract-calendar-month greg) 3) |
| 107 | (and (= (extract-calendar-month greg) 3) | 107 | (and (= (extract-calendar-month greg) 3) |
| 108 | (>= (extract-calendar-day greg) 21))) | 108 | (>= (extract-calendar-day greg) 21))) |
| 109 | 1 0))) | 109 | 1 0))) |
| 110 | (month ;; Search forward from Baha. | 110 | (month ; search forward from Baha |
| 111 | (1+ (calendar-sum m 1 | 111 | (1+ (calendar-sum m 1 |
| 112 | (> date | 112 | (> date |
| 113 | (calendar-absolute-from-bahai | 113 | (calendar-absolute-from-bahai |
| 114 | (list m 19 year))) | 114 | (list m 19 year))) |
| 115 | 1))) | 115 | 1))) |
| 116 | (day ;; Calculate the day by subtraction. | 116 | (day ; calculate the day by subtraction |
| 117 | (- date | 117 | (- date |
| 118 | (1- (calendar-absolute-from-bahai (list month 1 year)))))) | 118 | (1- (calendar-absolute-from-bahai (list month 1 year)))))) |
| 119 | (list month day year)))) | 119 | (list month day year)))) |
| @@ -199,9 +199,9 @@ nil if it is not visible in the current calendar window." | |||
| 199 | (y (extract-calendar-year bahai-date)) | 199 | (y (extract-calendar-year bahai-date)) |
| 200 | (date)) | 200 | (date)) |
| 201 | (if (< m 1) | 201 | (if (< m 1) |
| 202 | nil ;; Bahá'í calendar doesn't apply. | 202 | nil ; Bahá'í calendar doesn't apply |
| 203 | (increment-calendar-month m y (- 10 month)) | 203 | (increment-calendar-month m y (- 10 month)) |
| 204 | (if (> m 7) ;; Bahá'í date might be visible | 204 | (if (> m 7) ; Bahá'í date might be visible |
| 205 | (let ((date (calendar-gregorian-from-absolute | 205 | (let ((date (calendar-gregorian-from-absolute |
| 206 | (calendar-absolute-from-bahai (list month day y))))) | 206 | (calendar-absolute-from-bahai (list month day y))))) |
| 207 | (if (calendar-date-is-visible-p date) | 207 | (if (calendar-date-is-visible-p date) |
| @@ -272,10 +272,10 @@ calendar. This function is provided for use with the | |||
| 272 | (if (and (or (char-equal (preceding-char) ?\^M) | 272 | (if (and (or (char-equal (preceding-char) ?\^M) |
| 273 | (char-equal (preceding-char) ?\n)) | 273 | (char-equal (preceding-char) ?\n)) |
| 274 | (not (looking-at " \\|\^I"))) | 274 | (not (looking-at " \\|\^I"))) |
| 275 | ;; Diary entry that consists only of date. | 275 | ;; Diary entry that consists only of date. |
| 276 | (backward-char 1) | 276 | (backward-char 1) |
| 277 | ;; Found a nonempty diary entry--make it visible and | 277 | ;; Found a nonempty diary entry--make it visible and |
| 278 | ;; add it to the list. | 278 | ;; add it to the list. |
| 279 | (let ((entry-start (point)) | 279 | (let ((entry-start (point)) |
| 280 | (date-start)) | 280 | (date-start)) |
| 281 | (re-search-backward "\^M\\|\n\\|\\`") | 281 | (re-search-backward "\^M\\|\n\\|\\`") |
| @@ -320,7 +320,7 @@ nongregorian-diary-marking-hook." | |||
| 320 | (let* | 320 | (let* |
| 321 | ((date-form (if (equal (car (car d)) 'backup) | 321 | ((date-form (if (equal (car (car d)) 'backup) |
| 322 | (cdr (car d)) | 322 | (cdr (car d)) |
| 323 | (car d)));; ignore 'backup directive | 323 | (car d))) ; ignore 'backup directive |
| 324 | (dayname (diary-name-pattern calendar-day-name-array)) | 324 | (dayname (diary-name-pattern calendar-day-name-array)) |
| 325 | (monthname | 325 | (monthname |
| 326 | (concat | 326 | (concat |
| @@ -434,9 +434,9 @@ A value of 0 in any position is a wildcard." | |||
| 434 | (y (extract-calendar-year bahai-date)) | 434 | (y (extract-calendar-year bahai-date)) |
| 435 | (date)) | 435 | (date)) |
| 436 | (if (< m 1) | 436 | (if (< m 1) |
| 437 | nil;; Bahá'í calendar doesn't apply. | 437 | nil ; Bahá'í calendar doesn't apply |
| 438 | (increment-calendar-month m y (- 10 month)) | 438 | (increment-calendar-month m y (- 10 month)) |
| 439 | (if (> m 7);; Bahá'í date might be visible | 439 | (if (> m 7) ; Bahá'í date might be visible |
| 440 | (let ((date (calendar-gregorian-from-absolute | 440 | (let ((date (calendar-gregorian-from-absolute |
| 441 | (calendar-absolute-from-bahai | 441 | (calendar-absolute-from-bahai |
| 442 | (list month day y))))) | 442 | (list month day y))))) |