/[emacs]/emacs/lisp/calendar/cal-hebrew.el
ViewVC logotype

Diff of /emacs/lisp/calendar/cal-hebrew.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by rms, Wed Apr 3 14:24:36 2002 UTC revision 1.13 by rms, Mon Jul 22 15:31:13 2002 UTC
# Line 896  from the cursor position." Line 896  from the cursor position."
896    "Hebrew calendar equivalent of date diary entry."    "Hebrew calendar equivalent of date diary entry."
897    (format "Hebrew date (until sunset): %s" (calendar-hebrew-date-string date)))    (format "Hebrew date (until sunset): %s" (calendar-hebrew-date-string date)))
898    
899  (defun diary-omer ()  (defun diary-omer (&optional mark)
900    "Omer count diary entry.    "Omer count diary entry.
901  Entry applies if date is within 50 days after Passover."  Entry applies if date is within 50 days after Passover.
902    
903    An optional parameter MARK specifies a face or single-character string to
904    use when highlighting the day in the calendar."
905    (let* ((passover    (let* ((passover
906            (calendar-absolute-from-hebrew            (calendar-absolute-from-hebrew
907             (list 1 15 (+ (extract-calendar-year date) 3760))))             (list 1 15 (+ (extract-calendar-year date) 3760))))
# Line 906  Entry applies if date is within 50 days Line 909  Entry applies if date is within 50 days
909           (week (/ omer 7))           (week (/ omer 7))
910           (day (% omer 7)))           (day (% omer 7)))
911      (if (and (> omer 0) (< omer 50))      (if (and (> omer 0) (< omer 50))
912          (format "Day %d%s of the omer (until sunset)"          (cons mark
913                  omer                (format "Day %d%s of the omer (until sunset)"
914                  (if (zerop week)                        omer
915                      ""                        (if (zerop week)
916                    (format ", that is, %d week%s%s"                            ""
917                            week                          (format ", that is, %d week%s%s"
918                            (if (= week 1) "" "s")                                  week
919                            (if (zerop day)                                  (if (= week 1) "" "s")
920                                ""                                  (if (zerop day)
921                              (format " and %d day%s"                                      ""
922                                      day (if (= day 1) "" "s")))))))))                                    (format " and %d day%s"
923                                              day (if (= day 1) "" "s"))))))))))
924    
925  (defun diary-yahrzeit (death-month death-day death-year)  (defun diary-yahrzeit (death-month death-day death-year &optional mark)
926    "Yahrzeit diary entry--entry applies if date is yahrzeit or the day before.    "Yahrzeit diary entry--entry applies if date is yahrzeit or the day before.
927  Parameters are DEATH-MONTH, DEATH-DAY, DEATH-YEAR; the diary entry is assumed  Parameters are DEATH-MONTH, DEATH-DAY, DEATH-YEAR; the diary entry is assumed
928  to be the name of the person.  Date of death is on the *civil* calendar;  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  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  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."  order of the parameters is changed to DEATH-DAY, DEATH-MONTH, DEATH-YEAR.
932    
933    An optional parameter MARK specifies a face or single-character string to
934    use when highlighting the day in the calendar."
935    (let* ((h-date (calendar-hebrew-from-absolute    (let* ((h-date (calendar-hebrew-from-absolute
936                    (calendar-absolute-from-gregorian                    (calendar-absolute-from-gregorian
937                     (if european-calendar-style                     (if european-calendar-style
938                         (list death-day death-month death-year)                         (list death-day death-month death-year)
939                     (list death-month death-day death-year)))))                       (list death-month death-day death-year)))))
940           (h-month (extract-calendar-month h-date))           (h-month (extract-calendar-month h-date))
941           (h-day (extract-calendar-day h-date))           (h-day (extract-calendar-day h-date))
942           (h-year (extract-calendar-year h-date))           (h-year (extract-calendar-year h-date))
# Line 938  order of the parameters is changed to DE Line 945  order of the parameters is changed to DE
945           (diff (- yr h-year))           (diff (- yr h-year))
946           (y (hebrew-calendar-yahrzeit h-date yr)))           (y (hebrew-calendar-yahrzeit h-date yr)))
947      (if (and (> diff 0) (or (= y d) (= y (1+ d))))      (if (and (> diff 0) (or (= y d) (= y (1+ d))))
948          (format "Yahrzeit of %s%s: %d%s anniversary"          (cons mark
949                  entry                (format "Yahrzeit of %s%s: %d%s anniversary"
950                  (if (= y d) "" " (evening)")                        entry
951                  diff                        (if (= y d) "" " (evening)")
952                  (cond ((= (% diff 10) 1) "st")                        diff
953                        ((= (% diff 10) 2) "nd")                        (cond ((= (% diff 10) 1) "st")
954                        ((= (% diff 10) 3) "rd")                              ((= (% diff 10) 2) "nd")
955                        (t "th"))))))                              ((= (% diff 10) 3) "rd")
956                                (t "th")))))))
957    
958  (defun diary-rosh-hodesh ()  (defun diary-rosh-hodesh (&optional mark)
959    "Rosh Hodesh diary entry.    "Rosh Hodesh diary entry.
960  Entry applies if date is Rosh Hodesh, the day before, or the Saturday before."  Entry applies if date is Rosh Hodesh, the day before, or the Saturday before.
961    
962    An optional parameter MARK specifies a face or single-character string to
963    use when highlighting the day in the calendar."
964    (let* ((d (calendar-absolute-from-gregorian date))    (let* ((d (calendar-absolute-from-gregorian date))
965           (h-date (calendar-hebrew-from-absolute d))           (h-date (calendar-hebrew-from-absolute d))
966           (h-month (extract-calendar-month h-date))           (h-month (extract-calendar-month h-date))
# Line 965  Entry applies if date is Rosh Hodesh, th Line 976  Entry applies if date is Rosh Hodesh, th
976           (h-yesterday (extract-calendar-day           (h-yesterday (extract-calendar-day
977                         (calendar-hebrew-from-absolute (1- d)))))                         (calendar-hebrew-from-absolute (1- d)))))
978      (if (or (= h-day 30) (and (= h-day 1) (/= h-month 7)))      (if (or (= h-day 30) (and (= h-day 1) (/= h-month 7)))
979          (format          (cons mark
980           "Rosh Hodesh %s"                (format
981           (if (= h-day 30)                 "Rosh Hodesh %s"
982               (format                 (if (= h-day 30)
983                "%s (first day)"                     (format
984                ;; next month must be in the same year since this                      "%s (first day)"
985                ;; month can't be the last month of the year since                      ;; next month must be in the same year since this
986                ;; it has 30 days                      ;; month can't be the last month of the year since
987                (aref h-month-names h-month))                      ;; it has 30 days
988             (if (= h-yesterday 30)                      (aref h-month-names h-month))
989                 (format "%s (second day)" this-month)                   (if (= h-yesterday 30)
990               this-month)))                       (format "%s (second day)" this-month)
991        (if (= (% d 7) 6);; Saturday--check for Shabbat Mevarchim                     this-month))))
992            (cond ((and (> h-day 22) (/= h-month 6) (= 29 last-day))        (if (= (% d 7) 6) ;; Saturday--check for Shabbat Mevarchim
993                   (format "Mevarchim Rosh Hodesh %s (%s)"            (cons mark
994                           (aref h-month-names                  (cond ((and (> h-day 22) (/= h-month 6) (= 29 last-day))
995                                 (if (= h-month                         (format "Mevarchim Rosh Hodesh %s (%s)"
996                                        (hebrew-calendar-last-month-of-year                                 (aref h-month-names
997                                         h-year))                                       (if (= h-month
998                                     0 h-month))                                              (hebrew-calendar-last-month-of-year
999                           (aref calendar-day-name-array (- 29 h-day))))                                               h-year))
1000                  ((and (< h-day 30) (> h-day 22) (= 30 last-day))                                           0 h-month))
1001                   (format "Mevarchim Rosh Hodesh %s (%s-%s)"                                 (aref calendar-day-name-array (- 29 h-day))))
1002                           (aref h-month-names h-month)                        ((and (< h-day 30) (> h-day 22) (= 30 last-day))
1003                           (if (= h-day 29)                         (format "Mevarchim Rosh Hodesh %s (%s-%s)"
1004                               "tomorrow"                                 (aref h-month-names h-month)
1005                             (aref calendar-day-name-array (- 29 h-day)))                                 (if (= h-day 29)
1006                           (aref calendar-day-name-array                                     "tomorrow"
1007                                 (% (- 30 h-day) 7)))))                                   (aref calendar-day-name-array (- 29 h-day)))
1008                                   (aref calendar-day-name-array
1009                                         (% (- 30 h-day) 7))))))
1010          (if (and (= h-day 29) (/= h-month 6))          (if (and (= h-day 29) (/= h-month 6))
1011              (format "Erev Rosh Hodesh %s"              (cons (format "Erev Rosh Hodesh %s"
1012                      (aref h-month-names                            (aref h-month-names
1013                            (if (= h-month                                  (if (= h-month
1014                                   (hebrew-calendar-last-month-of-year                                         (hebrew-calendar-last-month-of-year
1015                                    h-year))                                          h-year))
1016                                0 h-month))))))))                                      0 h-month)))))))))
1017    
1018    (defun diary-parasha (&optional mark)
1019      "Parasha diary entry--entry applies if date is a Saturday.
1020    
1021  (defun diary-parasha ()  An optional parameter MARK specifies a face or single-character string to
1022    "Parasha diary entry--entry applies if date is a Saturday."  use when highlighting the day in the calendar."
1023    (let ((d (calendar-absolute-from-gregorian date)))    (let ((d (calendar-absolute-from-gregorian date)))
1024      (if (= (% d 7) 6);;  Saturday      (if (= (% d 7) 6) ;;  Saturday
1025          (let*          (let*
1026              ((h-year (extract-calendar-year              ((h-year (extract-calendar-year
1027                        (calendar-hebrew-from-absolute d)))                        (calendar-hebrew-from-absolute d)))
# Line 1024  Entry applies if date is Rosh Hodesh, th Line 1040  Entry applies if date is Rosh Hodesh, th
1040                           (t "regular")))                           (t "regular")))
1041               (year-format               (year-format
1042                (symbol-value                (symbol-value
1043                 (intern (format "hebrew-calendar-year-%s-%s-%s";; keviah                 (intern (format "hebrew-calendar-year-%s-%s-%s" ;; keviah
1044                                 rosh-hashanah-day type passover-day))))                                 rosh-hashanah-day type passover-day))))
1045               (first-saturday;; of Hebrew year               (first-saturday ;; of Hebrew year
1046                (calendar-dayname-on-or-before 6 (+ 6 rosh-hashanah)))                (calendar-dayname-on-or-before 6 (+ 6 rosh-hashanah)))
1047               (saturday;; which Saturday of the Hebrew year               (saturday ;; which Saturday of the Hebrew year
1048                (/ (- d first-saturday) 7))                (/ (- d first-saturday) 7))
1049               (parasha (aref year-format saturday)))               (parasha (aref year-format saturday)))
1050            (if parasha            (if parasha
1051                (format                (cons mark
1052                 "Parashat %s"                      (format
1053                 (if (listp parasha);; Israel differs from diaspora                       "Parashat %s"
1054                     (if (car parasha)                       (if (listp parasha) ;; Israel differs from diaspora
1055                         (format "%s (diaspora), %s (Israel)"                           (if (car parasha)
1056                                 (hebrew-calendar-parasha-name (car parasha))                               (format "%s (diaspora), %s (Israel)"
1057                                 (hebrew-calendar-parasha-name (cdr parasha)))                                       (hebrew-calendar-parasha-name (car parasha))
1058                       (format "%s (Israel)"                                       (hebrew-calendar-parasha-name (cdr parasha)))
1059                               (hebrew-calendar-parasha-name (cdr parasha))))                             (format "%s (Israel)"
1060                   (hebrew-calendar-parasha-name parasha))))))))                                     (hebrew-calendar-parasha-name (cdr parasha))))
1061                           (hebrew-calendar-parasha-name parasha)))))))))
1062    
1063  (defvar hebrew-calendar-parashiot-names  (defvar hebrew-calendar-parashiot-names
1064  ["Bereshith"   "Noah"      "Lech L'cha" "Vayera"    "Hayei Sarah" "Toledoth"  ["Bereshith"   "Noah"      "Lech L'cha" "Vayera"    "Hayei Sarah" "Toledoth"

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26