diff options
| -rw-r--r-- | lisp/calendar/cal-hebrew.el | 27 | ||||
| -rw-r--r-- | lisp/calendar/cal-julian.el | 3 |
2 files changed, 29 insertions, 1 deletions
diff --git a/lisp/calendar/cal-hebrew.el b/lisp/calendar/cal-hebrew.el index 1f751405fa2..8be06af42f3 100644 --- a/lisp/calendar/cal-hebrew.el +++ b/lisp/calendar/cal-hebrew.el | |||
| @@ -278,12 +278,37 @@ Gregorian date in the form of the list (((month day year) STRING)). Returns | |||
| 278 | nil if it is not visible in the current calendar window." | 278 | nil if it is not visible in the current calendar window." |
| 279 | ;; This test is only to speed things up a bit; it works fine without it. | 279 | ;; This test is only to speed things up a bit; it works fine without it. |
| 280 | (if (memq displayed-month | 280 | (if (memq displayed-month |
| 281 | ;; What this is doing is equivalent to +1,2,3,4,5 modulo 12, ie: | ||
| 282 | ;; (mapcar (lambda (n) (let ((x (mod n 12))) | ||
| 283 | ;; (if (zerop x) 12 | ||
| 284 | ;; x))) | ||
| 285 | ;; (number-sequence (1+ month) (+ 5 month))) | ||
| 286 | ;; Ie it makes a list: | ||
| 287 | ;; 2 3 4 5 6 when month = 1 | ||
| 288 | ;; 3 4 5 6 7 when month = 2 | ||
| 289 | ;; ... | ||
| 290 | ;; 8 9 10 11 12 when month = 7 | ||
| 291 | ;; 9 10 11 12 1 when month = 8 | ||
| 292 | ;; ... | ||
| 293 | ;; 12 1 2 3 4 when month = 11 | ||
| 294 | ;; 1 2 3 4 5 when month = 12 | ||
| 295 | ;; This implies that hebrew month N cannot occur outside | ||
| 296 | ;; Gregorian months N:N+6 (the calendar shows | ||
| 297 | ;; displayed-month +/- 1 at any time). | ||
| 298 | ;; So to put it another way: | ||
| 299 | ;; (calendar-interval month 1 displayed-month | ||
| 300 | ;; (if (> month displayed-month) 2 1)) | ||
| 301 | ;; must be >= 1 and <= 5. This could be expanded to: | ||
| 302 | ;; (if (> month displayed-month) (+ 12 (- displayed-month month)) | ||
| 303 | ;; (- displayed-month month) | ||
| 281 | (list | 304 | (list |
| 282 | (if (< 11 month) (- month 11) (+ month 1)) | 305 | (if (< 11 month) (- month 11) (+ month 1)) |
| 283 | (if (< 10 month) (- month 10) (+ month 2)) | 306 | (if (< 10 month) (- month 10) (+ month 2)) |
| 284 | (if (< 9 month) (- month 9) (+ month 3)) | 307 | (if (< 9 month) (- month 9) (+ month 3)) |
| 285 | (if (< 8 month) (- month 8) (+ month 4)) | 308 | (if (< 8 month) (- month 8) (+ month 4)) |
| 286 | (if (< 7 month) (- month 7) (+ month 5)))) | 309 | (if (< 7 month) (- month 7) (+ month 5)))) |
| 310 | ;; This is the same as holiday-julian, except the test of which | ||
| 311 | ;; year to use is different. | ||
| 287 | (let* ((m1 displayed-month) | 312 | (let* ((m1 displayed-month) |
| 288 | (y1 displayed-year) | 313 | (y1 displayed-year) |
| 289 | (m2 displayed-month) | 314 | (m2 displayed-month) |
| @@ -299,6 +324,8 @@ nil if it is not visible in the current calendar window." | |||
| 299 | (hebrew-end (calendar-hebrew-from-absolute end-date)) | 324 | (hebrew-end (calendar-hebrew-from-absolute end-date)) |
| 300 | (hebrew-y1 (extract-calendar-year hebrew-start)) | 325 | (hebrew-y1 (extract-calendar-year hebrew-start)) |
| 301 | (hebrew-y2 (extract-calendar-year hebrew-end)) | 326 | (hebrew-y2 (extract-calendar-year hebrew-end)) |
| 327 | ;; Hebrew new year is start of month 7. | ||
| 328 | ;; If hmonth >= 7, choose the higher year, y2. | ||
| 302 | (year (if (< 6 month) hebrew-y2 hebrew-y1)) | 329 | (year (if (< 6 month) hebrew-y2 hebrew-y1)) |
| 303 | (date (calendar-gregorian-from-absolute | 330 | (date (calendar-gregorian-from-absolute |
| 304 | (calendar-absolute-from-hebrew (list month day year))))) | 331 | (calendar-absolute-from-hebrew (list month day year))))) |
diff --git a/lisp/calendar/cal-julian.el b/lisp/calendar/cal-julian.el index 8e1efd0b261..ad9fa9815a4 100644 --- a/lisp/calendar/cal-julian.el +++ b/lisp/calendar/cal-julian.el | |||
| @@ -136,7 +136,6 @@ Driven by the variable `calendar-date-display-form'." | |||
| 136 | (defvar displayed-month) | 136 | (defvar displayed-month) |
| 137 | (defvar displayed-year) | 137 | (defvar displayed-year) |
| 138 | 138 | ||
| 139 | ;; FIXME same as hebrew | ||
| 140 | ;;;###holiday-autoload | 139 | ;;;###holiday-autoload |
| 141 | (defun holiday-julian (month day string) | 140 | (defun holiday-julian (month day string) |
| 142 | "Holiday on MONTH, DAY (Julian) called STRING. | 141 | "Holiday on MONTH, DAY (Julian) called STRING. |
| @@ -145,6 +144,8 @@ Gregorian date in the form of the list (((month day year) STRING)). Returns | |||
| 145 | nil if it is not visible in the current calendar window." | 144 | nil if it is not visible in the current calendar window." |
| 146 | ;; We need to choose the Julian year associated with month and day | 145 | ;; We need to choose the Julian year associated with month and day |
| 147 | ;; that might make them visible. | 146 | ;; that might make them visible. |
| 147 | ;; This is the same as holiday-hebrew, except that the test for | ||
| 148 | ;; which year to use is different. | ||
| 148 | (let* ((m1 displayed-month) | 149 | (let* ((m1 displayed-month) |
| 149 | (y1 displayed-year) | 150 | (y1 displayed-year) |
| 150 | (m2 displayed-month) | 151 | (m2 displayed-month) |