1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-29 07:58:28 +00:00

Small simplifications for some cal-hebrew calculations.

* lisp/calendar/cal-hebrew.el (holiday-hebrew-rosh-hashanah)
(holiday-hebrew-passover, holiday-hebrew-tisha-b-av)
(holiday-hebrew-misc): Small simplifications.
This commit is contained in:
Glenn Morris 2010-10-08 19:25:38 -07:00
parent 870b199e02
commit 85d50db7e4
2 changed files with 87 additions and 85 deletions

View File

@ -1,5 +1,9 @@
2010-10-09 Glenn Morris <rgm@gnu.org> 2010-10-09 Glenn Morris <rgm@gnu.org>
* calendar/cal-hebrew.el (holiday-hebrew-rosh-hashanah)
(holiday-hebrew-passover, holiday-hebrew-tisha-b-av)
(holiday-hebrew-misc): Small simplifications.
* emacs-lisp/authors.el (authors-valid-file-names): Add b2m.c. * emacs-lisp/authors.el (authors-valid-file-names): Add b2m.c.
* net/browse-url.el: Don't require thingatpt, term, dired, * net/browse-url.el: Don't require thingatpt, term, dired,

View File

@ -376,7 +376,7 @@ or ALL is non-nil."
(list (calendar-gregorian-from-absolute (1+ abs-r-h)) (list (calendar-gregorian-from-absolute (1+ abs-r-h))
"Rosh HaShanah (second day)") "Rosh HaShanah (second day)")
(list (calendar-gregorian-from-absolute (list (calendar-gregorian-from-absolute
(if (= (% abs-r-h 7) 4) (+ abs-r-h 3) (+ abs-r-h 2))) (+ abs-r-h (if (= (% abs-r-h 7) 4) 3 2)))
"Tzom Gedaliah") "Tzom Gedaliah")
(list (calendar-gregorian-from-absolute (list (calendar-gregorian-from-absolute
(calendar-dayname-on-or-before 6 (+ 7 abs-r-h))) (calendar-dayname-on-or-before 6 (+ 7 abs-r-h)))
@ -454,70 +454,71 @@ or ALL is non-nil."
(list (calendar-gregorian-from-absolute (+ abs-p 50)) (list (calendar-gregorian-from-absolute (+ abs-p 50))
"Shavuot")) "Shavuot"))
(when (or all calendar-hebrew-all-holidays-flag) (when (or all calendar-hebrew-all-holidays-flag)
(list (let ((wday (% abs-p 7)))
(list (calendar-gregorian-from-absolute (list
(calendar-dayname-on-or-before 6 (- abs-p 43))) (list (calendar-gregorian-from-absolute
"Shabbat Shekalim") (calendar-dayname-on-or-before 6 (- abs-p 43)))
(list (calendar-gregorian-from-absolute "Shabbat Shekalim")
(calendar-dayname-on-or-before 6 (- abs-p 30))) (list (calendar-gregorian-from-absolute
"Shabbat Zachor") (calendar-dayname-on-or-before 6 (- abs-p 30)))
(list (calendar-gregorian-from-absolute "Shabbat Zachor")
(if (= (% abs-p 7) 2) (- abs-p 33) (- abs-p 31))) (list (calendar-gregorian-from-absolute
"Fast of Esther") (- abs-p (if (= wday 2) 33 31)))
(list (calendar-gregorian-from-absolute (- abs-p 31)) "Fast of Esther")
"Erev Purim") (list (calendar-gregorian-from-absolute (- abs-p 31))
(list (calendar-gregorian-from-absolute (- abs-p 30)) "Erev Purim")
"Purim") (list (calendar-gregorian-from-absolute (- abs-p 30))
(list (calendar-gregorian-from-absolute "Purim")
(if (zerop (% abs-p 7)) (- abs-p 28) (- abs-p 29))) (list (calendar-gregorian-from-absolute
"Shushan Purim") (- abs-p (if (zerop wday) 28 29)))
(list (calendar-gregorian-from-absolute "Shushan Purim")
(- (calendar-dayname-on-or-before 6 (- abs-p 14)) 7)) (list (calendar-gregorian-from-absolute
"Shabbat Parah") (- (calendar-dayname-on-or-before 6 (- abs-p 14)) 7))
(list (calendar-gregorian-from-absolute "Shabbat Parah")
(calendar-dayname-on-or-before 6 (- abs-p 14))) (list (calendar-gregorian-from-absolute
"Shabbat HaHodesh") (calendar-dayname-on-or-before 6 (- abs-p 14)))
(list (calendar-gregorian-from-absolute "Shabbat HaHodesh")
(calendar-dayname-on-or-before 6 (1- abs-p))) (list (calendar-gregorian-from-absolute
"Shabbat HaGadol") (calendar-dayname-on-or-before 6 (1- abs-p)))
(list (calendar-gregorian-from-absolute (1- abs-p)) "Shabbat HaGadol")
"Erev Passover") (list (calendar-gregorian-from-absolute (1- abs-p))
(list (calendar-gregorian-from-absolute (1+ abs-p)) "Erev Passover")
"Passover (second day)") (list (calendar-gregorian-from-absolute (1+ abs-p))
(list (calendar-gregorian-from-absolute (+ abs-p 2)) "Passover (second day)")
"Hol Hamoed Passover (first day)") (list (calendar-gregorian-from-absolute (+ abs-p 2))
(list (calendar-gregorian-from-absolute (+ abs-p 3)) "Hol Hamoed Passover (first day)")
"Hol Hamoed Passover (second day)") (list (calendar-gregorian-from-absolute (+ abs-p 3))
(list (calendar-gregorian-from-absolute (+ abs-p 4)) "Hol Hamoed Passover (second day)")
"Hol Hamoed Passover (third day)") (list (calendar-gregorian-from-absolute (+ abs-p 4))
(list (calendar-gregorian-from-absolute (+ abs-p 5)) "Hol Hamoed Passover (third day)")
"Hol Hamoed Passover (fourth day)") (list (calendar-gregorian-from-absolute (+ abs-p 5))
(list (calendar-gregorian-from-absolute (+ abs-p 6)) "Hol Hamoed Passover (fourth day)")
"Passover (seventh day)") (list (calendar-gregorian-from-absolute (+ abs-p 6))
(list (calendar-gregorian-from-absolute (+ abs-p 7)) "Passover (seventh day)")
"Passover (eighth day)") (list (calendar-gregorian-from-absolute (+ abs-p 7))
(list (calendar-gregorian-from-absolute "Passover (eighth day)")
(if (zerop (% (+ abs-p 12) 7)) (list (calendar-gregorian-from-absolute
(+ abs-p 13) (+ abs-p (if (zerop (% (+ abs-p 12) 7))
(+ abs-p 12))) 13
"Yom HaShoah") 12)))
(list (calendar-gregorian-from-absolute "Yom HaShoah")
(if (zerop (% abs-p 7)) (list (calendar-gregorian-from-absolute
(+ abs-p 18) (+ abs-p
(if (= (% abs-p 7) 6) ;; If falls on Sat or Fri, moves to preceding Thurs.
(+ abs-p 19) ;; If falls on Mon, moves to Tues (since 2004).
(if (= (% abs-p 7) 2) (cond ((zerop wday) 18) ; Sat
(+ abs-p 21) ((= wday 6) 19) ; Fri
(+ abs-p 20))))) ((= wday 2) 21) ; Mon
"Yom HaAtzma'ut") (t 20))))
(list (calendar-gregorian-from-absolute (+ abs-p 33)) "Yom HaAtzma'ut")
"Lag BaOmer") (list (calendar-gregorian-from-absolute (+ abs-p 33))
(list (calendar-gregorian-from-absolute (+ abs-p 43)) "Lag BaOmer")
"Yom Yerushalaim") (list (calendar-gregorian-from-absolute (+ abs-p 43))
(list (calendar-gregorian-from-absolute (+ abs-p 49)) "Yom Yerushalaim")
"Erev Shavuot") (list (calendar-gregorian-from-absolute (+ abs-p 49))
(list (calendar-gregorian-from-absolute (+ abs-p 51)) "Erev Shavuot")
"Shavuot (second day)")))))))) (list (calendar-gregorian-from-absolute (+ abs-p 51))
"Shavuot (second day)")))))))))
;;;###holiday-autoload ;;;###holiday-autoload
(define-obsolete-function-alias 'holiday-passover-etc (define-obsolete-function-alias 'holiday-passover-etc
@ -527,18 +528,19 @@ or ALL is non-nil."
(defun holiday-hebrew-tisha-b-av () (defun holiday-hebrew-tisha-b-av ()
"List of dates around Tisha B'Av, as visible in calendar window." "List of dates around Tisha B'Av, as visible in calendar window."
(when (memq displayed-month '(5 6 7 8 9)) (when (memq displayed-month '(5 6 7 8 9))
(let ((abs-t-a (calendar-hebrew-to-absolute (let* ((abs-t-a (calendar-hebrew-to-absolute
(list 5 9 (+ displayed-year 3760))))) (list 5 9 (+ displayed-year 3760))))
(wday (% abs-t-a 7)))
(holiday-filter-visible-calendar (holiday-filter-visible-calendar
(list (list
(list (calendar-gregorian-from-absolute (list (calendar-gregorian-from-absolute
(if (= (% abs-t-a 7) 6) (- abs-t-a 20) (- abs-t-a 21))) (- abs-t-a (if (= wday 6) 20 21)))
"Tzom Tammuz") "Tzom Tammuz")
(list (calendar-gregorian-from-absolute (list (calendar-gregorian-from-absolute
(calendar-dayname-on-or-before 6 abs-t-a)) (calendar-dayname-on-or-before 6 abs-t-a))
"Shabbat Hazon") "Shabbat Hazon")
(list (calendar-gregorian-from-absolute (list (calendar-gregorian-from-absolute
(if (= (% abs-t-a 7) 6) (1+ abs-t-a) abs-t-a)) (if (= wday 6) (1+ abs-t-a) abs-t-a))
"Tisha B'Av") "Tisha B'Av")
(list (calendar-gregorian-from-absolute (list (calendar-gregorian-from-absolute
(calendar-dayname-on-or-before 6 (+ abs-t-a 7))) (calendar-dayname-on-or-before 6 (+ abs-t-a 7)))
@ -557,7 +559,7 @@ Includes: Tal Umatar, Tzom Teveth, Tu B'Shevat, Shabbat Shirah, and
Kiddush HaHamah." Kiddush HaHamah."
(let ((m displayed-month) (let ((m displayed-month)
(y displayed-year) (y displayed-year)
year h-year s-s) year h-year)
(append (append
(holiday-julian (holiday-julian
11 11
@ -591,20 +593,17 @@ Kiddush HaHamah."
(calendar-extract-year (calendar-extract-year
(calendar-hebrew-from-absolute (calendar-hebrew-from-absolute
(calendar-absolute-from-gregorian (calendar-absolute-from-gregorian
(list m (calendar-last-day-of-month m y) y))))) (list m (calendar-last-day-of-month m y) y))))))
s-s (calendar-extract-day
(calendar-hebrew-from-absolute (calendar-hebrew-from-absolute
(if (= 6 (calendar-dayname-on-or-before
(% (calendar-hebrew-to-absolute 6 (calendar-hebrew-to-absolute
(list 7 1 h-year)) (list 11
7)) (if (= 6
(calendar-dayname-on-or-before (% (calendar-hebrew-to-absolute
6 (calendar-hebrew-to-absolute (list 7 1 h-year))
(list 11 17 h-year))) 7))
(calendar-dayname-on-or-before 17 16) h-year))))))
6 (calendar-hebrew-to-absolute
(list 11 16 h-year))))))
(calendar-extract-day s-s))
"Shabbat Shirah") "Shabbat Shirah")
(and (progn (and (progn
(setq m displayed-month (setq m displayed-month
@ -1162,5 +1161,4 @@ use when highlighting the day in the calendar."
(provide 'cal-hebrew) (provide 'cal-hebrew)
;; arch-tag: aaab6718-7712-42ac-a32d-28fe1f944f3c
;;; cal-hebrew.el ends here ;;; cal-hebrew.el ends here