/[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.12.2.1 by miles, Fri Apr 4 06:20:15 2003 UTC
# Line 115  Gregorian date Sunday, December 31, 1 BC Line 115  Gregorian date Sunday, December 31, 1 BC
115              day)))              day)))
116      (if ;; If Rosh HaShanah would occur on Sunday, Wednesday, or Friday      (if ;; If Rosh HaShanah would occur on Sunday, Wednesday, or Friday
117          (memq (% alternative-day 7) (list 0 3 5))          (memq (% alternative-day 7) (list 0 3 5))
118    ;; Then postpone it one (more) day and return            ;; Then postpone it one (more) day and return
119          (1+ alternative-day)          (1+ alternative-day)
120    ;; Else return            ;; Else return
121        alternative-day)))        alternative-day)))
122    
123  (defun hebrew-calendar-days-in-year (year)  (defun hebrew-calendar-days-in-year (year)
# Line 316  nil if it is not visible in the current Line 316  nil if it is not visible in the current
316                (list (calendar-gregorian-from-absolute (+ abs-r-h 22))                (list (calendar-gregorian-from-absolute (+ abs-r-h 22))
317                      "Simchat Torah")))                      "Simchat Torah")))
318             (optional             (optional
319              (list              (list
320               (list (calendar-gregorian-from-absolute               (list (calendar-gregorian-from-absolute
321                      (calendar-dayname-on-or-before 6 (- abs-r-h 4)))                      (calendar-dayname-on-or-before 6 (- abs-r-h 4)))
322                     "Selichot (night)")                     "Selichot (night)")
# Line 350  nil if it is not visible in the current Line 350  nil if it is not visible in the current
350               (filter-visible-calendar-holidays mandatory)))               (filter-visible-calendar-holidays mandatory)))
351        (if all-hebrew-calendar-holidays        (if all-hebrew-calendar-holidays
352            (setq output-list            (setq output-list
353                  (append                  (append
354                   (filter-visible-calendar-holidays optional)                   (filter-visible-calendar-holidays optional)
355                   output-list)))                   output-list)))
356        output-list)))        output-list)))
# Line 401  nil if it is not visible in the current Line 401  nil if it is not visible in the current
401               (list (calendar-gregorian-from-absolute (+ abs-p 50))               (list (calendar-gregorian-from-absolute (+ abs-p 50))
402                     "Shavuot")))                     "Shavuot")))
403             (optional             (optional
404              (list              (list
405               (list (calendar-gregorian-from-absolute               (list (calendar-gregorian-from-absolute
406                      (calendar-dayname-on-or-before 6 (- abs-p 43)))                      (calendar-dayname-on-or-before 6 (- abs-p 43)))
407                     "Shabbat Shekalim")                     "Shabbat Shekalim")
# Line 467  nil if it is not visible in the current Line 467  nil if it is not visible in the current
467               (filter-visible-calendar-holidays mandatory)))               (filter-visible-calendar-holidays mandatory)))
468        (if all-hebrew-calendar-holidays        (if all-hebrew-calendar-holidays
469            (setq output-list            (setq output-list
470                  (append                  (append
471                   (filter-visible-calendar-holidays optional)                   (filter-visible-calendar-holidays optional)
472                   output-list)))                   output-list)))
473        output-list)))        output-list)))
# Line 481  nil if it is not visible in the current Line 481  nil if it is not visible in the current
481                        (list 5 9 (+ displayed-year 3760)))))                        (list 5 9 (+ displayed-year 3760)))))
482    
483        (filter-visible-calendar-holidays        (filter-visible-calendar-holidays
484         (list         (list
485          (list (calendar-gregorian-from-absolute          (list (calendar-gregorian-from-absolute
486                 (if (= (% abs-t-a 7) 6) (- abs-t-a 20) (- abs-t-a 21)))                 (if (= (% abs-t-a 7) 6) (- abs-t-a 20) (- abs-t-a 21)))
487                "Tzom Tammuz")                "Tzom Tammuz")
# Line 513  not be marked in the calendar.  This fun Line 513  not be marked in the calendar.  This fun
513              (mark (regexp-quote diary-nonmarking-symbol)))              (mark (regexp-quote diary-nonmarking-symbol)))
514          (calendar-for-loop i from 1 to number do          (calendar-for-loop i from 1 to number do
515             (let* ((d diary-date-forms)             (let* ((d diary-date-forms)
516                    (hdate (calendar-hebrew-from-absolute                    (hdate (calendar-hebrew-from-absolute
517                            (calendar-absolute-from-gregorian gdate)))                            (calendar-absolute-from-gregorian gdate)))
518                    (month (extract-calendar-month hdate))                    (month (extract-calendar-month hdate))
519                    (day (extract-calendar-day hdate))                    (day (extract-calendar-day hdate))
# Line 683  is provided for use as part of the nongr Line 683  is provided for use as part of the nongr
683                        (setq mm 0)                        (setq mm 0)
684                      (setq                      (setq
685                        mm                        mm
686                        (cdr                        (cdr
687                          (assoc-ignore-case                          (assoc-ignore-case
688                           mm-name                           mm-name
689                           (calendar-make-alist                           (calendar-make-alist
# Line 775  Prefix arg will make the entry nonmarkin Line 775  Prefix arg will make the entry nonmarkin
775      (make-diary-entry      (make-diary-entry
776       (concat       (concat
777        hebrew-diary-entry-symbol        hebrew-diary-entry-symbol
778        (calendar-date-string        (calendar-date-string
779         (calendar-hebrew-from-absolute         (calendar-hebrew-from-absolute
780          (calendar-absolute-from-gregorian          (calendar-absolute-from-gregorian
781           (calendar-cursor-to-date t)))           (calendar-cursor-to-date t)))
# Line 794  Prefix arg will make the entry nonmarkin Line 794  Prefix arg will make the entry nonmarkin
794      (make-diary-entry      (make-diary-entry
795       (concat       (concat
796        hebrew-diary-entry-symbol        hebrew-diary-entry-symbol
797        (calendar-date-string        (calendar-date-string
798         (calendar-hebrew-from-absolute         (calendar-hebrew-from-absolute
799          (calendar-absolute-from-gregorian          (calendar-absolute-from-gregorian
800           (calendar-cursor-to-date t)))))           (calendar-cursor-to-date t)))))
# Line 814  Prefix arg will make the entry nonmarkin Line 814  Prefix arg will make the entry nonmarkin
814      (make-diary-entry      (make-diary-entry
815       (concat       (concat
816        hebrew-diary-entry-symbol        hebrew-diary-entry-symbol
817        (calendar-date-string        (calendar-date-string
818         (calendar-hebrew-from-absolute         (calendar-hebrew-from-absolute
819          (calendar-absolute-from-gregorian          (calendar-absolute-from-gregorian
820           (calendar-cursor-to-date t)))))           (calendar-cursor-to-date t)))))
# 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 mark
1012                      (aref h-month-names                    (format "Erev Rosh Hodesh %s"
1013                            (if (= h-month                            (aref h-month-names
1014                                   (hebrew-calendar-last-month-of-year                                  (if (= h-month
1015                                    h-year))                                         (hebrew-calendar-last-month-of-year
1016                                0 h-month))))))))                                          h-year))
1017                                        0 h-month)))))))))
1018    
1019    (defun diary-parasha (&optional mark)
1020      "Parasha diary entry--entry applies if date is a Saturday.
1021    
1022  (defun diary-parasha ()  An optional parameter MARK specifies a face or single-character string to
1023    "Parasha diary entry--entry applies if date is a Saturday."  use when highlighting the day in the calendar."
1024    (let ((d (calendar-absolute-from-gregorian date)))    (let ((d (calendar-absolute-from-gregorian date)))
1025      (if (= (% d 7) 6);;  Saturday      (if (= (% d 7) 6) ;;  Saturday
1026          (let*          (let*
1027              ((h-year (extract-calendar-year              ((h-year (extract-calendar-year
1028                        (calendar-hebrew-from-absolute d)))                        (calendar-hebrew-from-absolute d)))
# Line 1024  Entry applies if date is Rosh Hodesh, th Line 1041  Entry applies if date is Rosh Hodesh, th
1041                           (t "regular")))                           (t "regular")))
1042               (year-format               (year-format
1043                (symbol-value                (symbol-value
1044                 (intern (format "hebrew-calendar-year-%s-%s-%s";; keviah                 (intern (format "hebrew-calendar-year-%s-%s-%s" ;; keviah
1045                                 rosh-hashanah-day type passover-day))))                                 rosh-hashanah-day type passover-day))))
1046               (first-saturday;; of Hebrew year               (first-saturday ;; of Hebrew year
1047                (calendar-dayname-on-or-before 6 (+ 6 rosh-hashanah)))                (calendar-dayname-on-or-before 6 (+ 6 rosh-hashanah)))
1048               (saturday;; which Saturday of the Hebrew year               (saturday ;; which Saturday of the Hebrew year
1049                (/ (- d first-saturday) 7))                (/ (- d first-saturday) 7))
1050               (parasha (aref year-format saturday)))               (parasha (aref year-format saturday)))
1051            (if parasha            (if parasha
1052                (format                (cons mark
1053                 "Parashat %s"                      (format
1054                 (if (listp parasha);; Israel differs from diaspora                       "Parashat %s"
1055                     (if (car parasha)                       (if (listp parasha) ;; Israel differs from diaspora
1056                         (format "%s (diaspora), %s (Israel)"                           (if (car parasha)
1057                                 (hebrew-calendar-parasha-name (car parasha))                               (format "%s (diaspora), %s (Israel)"
1058                                 (hebrew-calendar-parasha-name (cdr parasha)))                                       (hebrew-calendar-parasha-name (car parasha))
1059                       (format "%s (Israel)"                                       (hebrew-calendar-parasha-name (cdr parasha)))
1060                               (hebrew-calendar-parasha-name (cdr parasha))))                             (format "%s (Israel)"
1061                   (hebrew-calendar-parasha-name parasha))))))))                                     (hebrew-calendar-parasha-name (cdr parasha))))
1062                           (hebrew-calendar-parasha-name parasha)))))))))
1063    
1064  (defvar hebrew-calendar-parashiot-names  (defvar hebrew-calendar-parashiot-names
1065  ["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.12.2.1

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