comparison lisp/calendar/cal-hebrew.el @ 49598:0d8b17d428b5

Trailing whitepace deleted.
author Juanma Barranquero <lekktu@gmail.com>
date Tue, 04 Feb 2003 13:24:35 +0000
parents e82d42ccd30b
children af8f4ec2f255 d7ddb3e565de
comparison
equal deleted inserted replaced
49597:e88404e8f2cf 49598:0d8b17d428b5
113 (1+ day) 113 (1+ day)
114 ;; Else 114 ;; Else
115 day))) 115 day)))
116 (if ;; If Rosh HaShanah would occur on Sunday, Wednesday, or Friday 116 (if ;; If Rosh HaShanah would occur on Sunday, Wednesday, or Friday
117 (memq (% alternative-day 7) (list 0 3 5)) 117 (memq (% alternative-day 7) (list 0 3 5))
118 ;; Then postpone it one (more) day and return 118 ;; Then postpone it one (more) day and return
119 (1+ alternative-day) 119 (1+ alternative-day)
120 ;; Else return 120 ;; Else return
121 alternative-day))) 121 alternative-day)))
122 122
123 (defun hebrew-calendar-days-in-year (year) 123 (defun hebrew-calendar-days-in-year (year)
124 "Number of days in Hebrew YEAR." 124 "Number of days in Hebrew YEAR."
125 (- (hebrew-calendar-elapsed-days (1+ year)) 125 (- (hebrew-calendar-elapsed-days (1+ year))
314 (list (calendar-gregorian-from-absolute (+ abs-r-h 21)) 314 (list (calendar-gregorian-from-absolute (+ abs-r-h 21))
315 "Shemini Atzeret") 315 "Shemini Atzeret")
316 (list (calendar-gregorian-from-absolute (+ abs-r-h 22)) 316 (list (calendar-gregorian-from-absolute (+ abs-r-h 22))
317 "Simchat Torah"))) 317 "Simchat Torah")))
318 (optional 318 (optional
319 (list 319 (list
320 (list (calendar-gregorian-from-absolute 320 (list (calendar-gregorian-from-absolute
321 (calendar-dayname-on-or-before 6 (- abs-r-h 4))) 321 (calendar-dayname-on-or-before 6 (- abs-r-h 4)))
322 "Selichot (night)") 322 "Selichot (night)")
323 (list (calendar-gregorian-from-absolute (1- abs-r-h)) 323 (list (calendar-gregorian-from-absolute (1- abs-r-h))
324 "Erev Rosh HaShanah") 324 "Erev Rosh HaShanah")
348 "Hoshanah Rabbah"))) 348 "Hoshanah Rabbah")))
349 (output-list 349 (output-list
350 (filter-visible-calendar-holidays mandatory))) 350 (filter-visible-calendar-holidays mandatory)))
351 (if all-hebrew-calendar-holidays 351 (if all-hebrew-calendar-holidays
352 (setq output-list 352 (setq output-list
353 (append 353 (append
354 (filter-visible-calendar-holidays optional) 354 (filter-visible-calendar-holidays optional)
355 output-list))) 355 output-list)))
356 output-list))) 356 output-list)))
357 357
358 (defun holiday-hanukkah () 358 (defun holiday-hanukkah ()
399 (list (calendar-gregorian-from-absolute abs-p) 399 (list (calendar-gregorian-from-absolute abs-p)
400 "Passover") 400 "Passover")
401 (list (calendar-gregorian-from-absolute (+ abs-p 50)) 401 (list (calendar-gregorian-from-absolute (+ abs-p 50))
402 "Shavuot"))) 402 "Shavuot")))
403 (optional 403 (optional
404 (list 404 (list
405 (list (calendar-gregorian-from-absolute 405 (list (calendar-gregorian-from-absolute
406 (calendar-dayname-on-or-before 6 (- abs-p 43))) 406 (calendar-dayname-on-or-before 6 (- abs-p 43)))
407 "Shabbat Shekalim") 407 "Shabbat Shekalim")
408 (list (calendar-gregorian-from-absolute 408 (list (calendar-gregorian-from-absolute
409 (calendar-dayname-on-or-before 6 (- abs-p 30))) 409 (calendar-dayname-on-or-before 6 (- abs-p 30)))
465 "Shavuot (second day)"))) 465 "Shavuot (second day)")))
466 (output-list 466 (output-list
467 (filter-visible-calendar-holidays mandatory))) 467 (filter-visible-calendar-holidays mandatory)))
468 (if all-hebrew-calendar-holidays 468 (if all-hebrew-calendar-holidays
469 (setq output-list 469 (setq output-list
470 (append 470 (append
471 (filter-visible-calendar-holidays optional) 471 (filter-visible-calendar-holidays optional)
472 output-list))) 472 output-list)))
473 output-list))) 473 output-list)))
474 474
475 (defun holiday-tisha-b-av-etc () 475 (defun holiday-tisha-b-av-etc ()
479 nil;; None of the dates is visible 479 nil;; None of the dates is visible
480 (let* ((abs-t-a (calendar-absolute-from-hebrew 480 (let* ((abs-t-a (calendar-absolute-from-hebrew
481 (list 5 9 (+ displayed-year 3760))))) 481 (list 5 9 (+ displayed-year 3760)))))
482 482
483 (filter-visible-calendar-holidays 483 (filter-visible-calendar-holidays
484 (list 484 (list
485 (list (calendar-gregorian-from-absolute 485 (list (calendar-gregorian-from-absolute
486 (if (= (% abs-t-a 7) 6) (- abs-t-a 20) (- abs-t-a 21))) 486 (if (= (% abs-t-a 7) 6) (- abs-t-a 20) (- abs-t-a 21)))
487 "Tzom Tammuz") 487 "Tzom Tammuz")
488 (list (calendar-gregorian-from-absolute 488 (list (calendar-gregorian-from-absolute
489 (calendar-dayname-on-or-before 6 abs-t-a)) 489 (calendar-dayname-on-or-before 6 abs-t-a))
511 (diary-modified (buffer-modified-p)) 511 (diary-modified (buffer-modified-p))
512 (gdate original-date) 512 (gdate original-date)
513 (mark (regexp-quote diary-nonmarking-symbol))) 513 (mark (regexp-quote diary-nonmarking-symbol)))
514 (calendar-for-loop i from 1 to number do 514 (calendar-for-loop i from 1 to number do
515 (let* ((d diary-date-forms) 515 (let* ((d diary-date-forms)
516 (hdate (calendar-hebrew-from-absolute 516 (hdate (calendar-hebrew-from-absolute
517 (calendar-absolute-from-gregorian gdate))) 517 (calendar-absolute-from-gregorian gdate)))
518 (month (extract-calendar-month hdate)) 518 (month (extract-calendar-month hdate))
519 (day (extract-calendar-day hdate)) 519 (day (extract-calendar-day hdate))
520 (year (extract-calendar-year hdate))) 520 (year (extract-calendar-year hdate)))
521 (while d 521 (while d
681 (if mm-name 681 (if mm-name
682 (if (string-equal mm-name "*") 682 (if (string-equal mm-name "*")
683 (setq mm 0) 683 (setq mm 0)
684 (setq 684 (setq
685 mm 685 mm
686 (cdr 686 (cdr
687 (assoc-ignore-case 687 (assoc-ignore-case
688 mm-name 688 mm-name
689 (calendar-make-alist 689 (calendar-make-alist
690 calendar-hebrew-month-name-array-leap-year)))))) 690 calendar-hebrew-month-name-array-leap-year))))))
691 (mark-hebrew-calendar-date-pattern mm dd yy))))) 691 (mark-hebrew-calendar-date-pattern mm dd yy)))))
773 (let* ((calendar-month-name-array 773 (let* ((calendar-month-name-array
774 calendar-hebrew-month-name-array-leap-year)) 774 calendar-hebrew-month-name-array-leap-year))
775 (make-diary-entry 775 (make-diary-entry
776 (concat 776 (concat
777 hebrew-diary-entry-symbol 777 hebrew-diary-entry-symbol
778 (calendar-date-string 778 (calendar-date-string
779 (calendar-hebrew-from-absolute 779 (calendar-hebrew-from-absolute
780 (calendar-absolute-from-gregorian 780 (calendar-absolute-from-gregorian
781 (calendar-cursor-to-date t))) 781 (calendar-cursor-to-date t)))
782 nil t)) 782 nil t))
783 arg))) 783 arg)))
792 (calendar-month-name-array 792 (calendar-month-name-array
793 calendar-hebrew-month-name-array-leap-year)) 793 calendar-hebrew-month-name-array-leap-year))
794 (make-diary-entry 794 (make-diary-entry
795 (concat 795 (concat
796 hebrew-diary-entry-symbol 796 hebrew-diary-entry-symbol
797 (calendar-date-string 797 (calendar-date-string
798 (calendar-hebrew-from-absolute 798 (calendar-hebrew-from-absolute
799 (calendar-absolute-from-gregorian 799 (calendar-absolute-from-gregorian
800 (calendar-cursor-to-date t))))) 800 (calendar-cursor-to-date t)))))
801 arg))) 801 arg)))
802 802
812 (calendar-month-name-array 812 (calendar-month-name-array
813 calendar-hebrew-month-name-array-leap-year)) 813 calendar-hebrew-month-name-array-leap-year))
814 (make-diary-entry 814 (make-diary-entry
815 (concat 815 (concat
816 hebrew-diary-entry-symbol 816 hebrew-diary-entry-symbol
817 (calendar-date-string 817 (calendar-date-string
818 (calendar-hebrew-from-absolute 818 (calendar-hebrew-from-absolute
819 (calendar-absolute-from-gregorian 819 (calendar-absolute-from-gregorian
820 (calendar-cursor-to-date t))))) 820 (calendar-cursor-to-date t)))))
821 arg))) 821 arg)))
822 822
898 898
899 (defun diary-omer (&optional mark) 899 (defun diary-omer (&optional mark)
900 "Omer count diary entry. 900 "Omer count diary entry.
901 Entry applies if date is within 50 days after Passover. 901 Entry applies if date is within 50 days after Passover.
902 902
903 An optional parameter MARK specifies a face or single-character string to 903 An optional parameter MARK specifies a face or single-character string to
904 use when highlighting the day in the calendar." 904 use when highlighting the day in the calendar."
905 (let* ((passover 905 (let* ((passover
906 (calendar-absolute-from-hebrew 906 (calendar-absolute-from-hebrew
907 (list 1 15 (+ (extract-calendar-year date) 3760)))) 907 (list 1 15 (+ (extract-calendar-year date) 3760))))
908 (omer (- (calendar-absolute-from-gregorian date) passover)) 908 (omer (- (calendar-absolute-from-gregorian date) passover))
909 (week (/ omer 7)) 909 (week (/ omer 7))
910 (day (% omer 7))) 910 (day (% omer 7)))
911 (if (and (> omer 0) (< omer 50)) 911 (if (and (> omer 0) (< omer 50))
912 (cons mark 912 (cons mark
913 (format "Day %d%s of the omer (until sunset)" 913 (format "Day %d%s of the omer (until sunset)"
914 omer 914 omer
915 (if (zerop week) 915 (if (zerop week)
916 "" 916 ""
917 (format ", that is, %d week%s%s" 917 (format ", that is, %d week%s%s"
928 to be the name of the person. Date of death is on the *civil* calendar; 928 to be the name of the person. Date of death is on the *civil* calendar;
929 although the date of death is specified by the civil calendar, the proper 929 although the date of death is specified by the civil calendar, the proper
930 Hebrew calendar yahrzeit is determined. If `european-calendar-style' is t, the 930 Hebrew calendar yahrzeit is determined. If `european-calendar-style' is t, the
931 order of the parameters is changed to DEATH-DAY, DEATH-MONTH, DEATH-YEAR. 931 order of the parameters is changed to DEATH-DAY, DEATH-MONTH, DEATH-YEAR.
932 932
933 An optional parameter MARK specifies a face or single-character string to 933 An optional parameter MARK specifies a face or single-character string to
934 use when highlighting the day in the calendar." 934 use when highlighting the day in the calendar."
935 (let* ((h-date (calendar-hebrew-from-absolute 935 (let* ((h-date (calendar-hebrew-from-absolute
936 (calendar-absolute-from-gregorian 936 (calendar-absolute-from-gregorian
937 (if european-calendar-style 937 (if european-calendar-style
938 (list death-day death-month death-year) 938 (list death-day death-month death-year)
957 957
958 (defun diary-rosh-hodesh (&optional mark) 958 (defun diary-rosh-hodesh (&optional mark)
959 "Rosh Hodesh diary entry. 959 "Rosh Hodesh diary entry.
960 Entry applies if date is Rosh Hodesh, the day before, or the Saturday before. 960 Entry applies if date is Rosh Hodesh, the day before, or the Saturday before.
961 961
962 An optional parameter MARK specifies a face or single-character string to 962 An optional parameter MARK specifies a face or single-character string to
963 use when highlighting the day in the calendar." 963 use when highlighting the day in the calendar."
964 (let* ((d (calendar-absolute-from-gregorian date)) 964 (let* ((d (calendar-absolute-from-gregorian date))
965 (h-date (calendar-hebrew-from-absolute d)) 965 (h-date (calendar-hebrew-from-absolute d))
966 (h-month (extract-calendar-month h-date)) 966 (h-month (extract-calendar-month h-date))
967 (h-day (extract-calendar-day h-date)) 967 (h-day (extract-calendar-day h-date))
974 calendar-hebrew-month-name-array-common-year)) 974 calendar-hebrew-month-name-array-common-year))
975 (this-month (aref h-month-names (1- h-month))) 975 (this-month (aref h-month-names (1- h-month)))
976 (h-yesterday (extract-calendar-day 976 (h-yesterday (extract-calendar-day
977 (calendar-hebrew-from-absolute (1- d))))) 977 (calendar-hebrew-from-absolute (1- d)))))
978 (if (or (= h-day 30) (and (= h-day 1) (/= h-month 7))) 978 (if (or (= h-day 30) (and (= h-day 1) (/= h-month 7)))
979 (cons mark 979 (cons mark
980 (format 980 (format
981 "Rosh Hodesh %s" 981 "Rosh Hodesh %s"
982 (if (= h-day 30) 982 (if (= h-day 30)
983 (format 983 (format
984 "%s (first day)" 984 "%s (first day)"
988 (aref h-month-names h-month)) 988 (aref h-month-names h-month))
989 (if (= h-yesterday 30) 989 (if (= h-yesterday 30)
990 (format "%s (second day)" this-month) 990 (format "%s (second day)" this-month)
991 this-month)))) 991 this-month))))
992 (if (= (% d 7) 6) ;; Saturday--check for Shabbat Mevarchim 992 (if (= (% d 7) 6) ;; Saturday--check for Shabbat Mevarchim
993 (cons mark 993 (cons mark
994 (cond ((and (> h-day 22) (/= h-month 6) (= 29 last-day)) 994 (cond ((and (> h-day 22) (/= h-month 6) (= 29 last-day))
995 (format "Mevarchim Rosh Hodesh %s (%s)" 995 (format "Mevarchim Rosh Hodesh %s (%s)"
996 (aref h-month-names 996 (aref h-month-names
997 (if (= h-month 997 (if (= h-month
998 (hebrew-calendar-last-month-of-year 998 (hebrew-calendar-last-month-of-year
1017 0 h-month))))))))) 1017 0 h-month)))))))))
1018 1018
1019 (defun diary-parasha (&optional mark) 1019 (defun diary-parasha (&optional mark)
1020 "Parasha diary entry--entry applies if date is a Saturday. 1020 "Parasha diary entry--entry applies if date is a Saturday.
1021 1021
1022 An optional parameter MARK specifies a face or single-character string to 1022 An optional parameter MARK specifies a face or single-character string to
1023 use when highlighting the day in the calendar." 1023 use when highlighting the day in the calendar."
1024 (let ((d (calendar-absolute-from-gregorian date))) 1024 (let ((d (calendar-absolute-from-gregorian date)))
1025 (if (= (% d 7) 6) ;; Saturday 1025 (if (= (% d 7) 6) ;; Saturday
1026 (let* 1026 (let*
1027 ((h-year (extract-calendar-year 1027 ((h-year (extract-calendar-year