aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2002-07-22 15:31:13 +0000
committerRichard M. Stallman2002-07-22 15:31:13 +0000
commit9a27723cd82078e5804bf91ce44597b49450a96f (patch)
tree6ef1fff397e1b4aeaa1aee002d2dca88f0bb3157
parente0ab9b68c524894ba844a0b3cf0bb1b2dd9a120f (diff)
downloademacs-9a27723cd82078e5804bf91ce44597b49450a96f.tar.gz
emacs-9a27723cd82078e5804bf91ce44597b49450a96f.zip
(diary-omer, diary-yahrzeit, diary-rosh-hodesh, diary-parasha, diary-parasha):
Add optional MARK parameter, specifying what face or character to use in the calendar display. These will now return (MARK . ENTRY).
-rw-r--r--lisp/calendar/cal-hebrew.el177
1 files changed, 97 insertions, 80 deletions
diff --git a/lisp/calendar/cal-hebrew.el b/lisp/calendar/cal-hebrew.el
index 3ba6b438c63..9bd3886eb42 100644
--- a/lisp/calendar/cal-hebrew.el
+++ b/lisp/calendar/cal-hebrew.el
@@ -896,9 +896,12 @@ from the cursor position."
896 "Hebrew calendar equivalent of date diary entry." 896 "Hebrew calendar equivalent of date diary entry."
897 (format "Hebrew date (until sunset): %s" (calendar-hebrew-date-string date))) 897 (format "Hebrew date (until sunset): %s" (calendar-hebrew-date-string date)))
898 898
899(defun diary-omer () 899(defun diary-omer (&optional mark)
900 "Omer count diary entry. 900 "Omer count diary entry.
901Entry applies if date is within 50 days after Passover." 901Entry applies if date is within 50 days after Passover.
902
903An optional parameter MARK specifies a face or single-character string to
904use when highlighting the day in the calendar."
902 (let* ((passover 905 (let* ((passover
903 (calendar-absolute-from-hebrew 906 (calendar-absolute-from-hebrew
904 (list 1 15 (+ (extract-calendar-year date) 3760)))) 907 (list 1 15 (+ (extract-calendar-year date) 3760))))
@@ -906,30 +909,34 @@ Entry applies if date is within 50 days after Passover."
906 (week (/ omer 7)) 909 (week (/ omer 7))
907 (day (% omer 7))) 910 (day (% omer 7)))
908 (if (and (> omer 0) (< omer 50)) 911 (if (and (> omer 0) (< omer 50))
909 (format "Day %d%s of the omer (until sunset)" 912 (cons mark
910 omer 913 (format "Day %d%s of the omer (until sunset)"
911 (if (zerop week) 914 omer
912 "" 915 (if (zerop week)
913 (format ", that is, %d week%s%s" 916 ""
914 week 917 (format ", that is, %d week%s%s"
915 (if (= week 1) "" "s") 918 week
916 (if (zerop day) 919 (if (= week 1) "" "s")
917 "" 920 (if (zerop day)
918 (format " and %d day%s" 921 ""
919 day (if (= day 1) "" "s"))))))))) 922 (format " and %d day%s"
920 923 day (if (= day 1) "" "s"))))))))))
921(defun diary-yahrzeit (death-month death-day death-year) 924
925(defun diary-yahrzeit (death-month death-day death-year &optional mark)
922 "Yahrzeit diary entry--entry applies if date is yahrzeit or the day before. 926 "Yahrzeit diary entry--entry applies if date is yahrzeit or the day before.
923Parameters are DEATH-MONTH, DEATH-DAY, DEATH-YEAR; the diary entry is assumed 927Parameters are DEATH-MONTH, DEATH-DAY, DEATH-YEAR; the diary entry is assumed
924to be the name of the person. Date of death is on the *civil* calendar; 928to be the name of the person. Date of death is on the *civil* calendar;
925although the date of death is specified by the civil calendar, the proper 929although the date of death is specified by the civil calendar, the proper
926Hebrew calendar yahrzeit is determined. If `european-calendar-style' is t, the 930Hebrew calendar yahrzeit is determined. If `european-calendar-style' is t, the
927order of the parameters is changed to DEATH-DAY, DEATH-MONTH, DEATH-YEAR." 931order of the parameters is changed to DEATH-DAY, DEATH-MONTH, DEATH-YEAR.
932
933An optional parameter MARK specifies a face or single-character string to
934use when highlighting the day in the calendar."
928 (let* ((h-date (calendar-hebrew-from-absolute 935 (let* ((h-date (calendar-hebrew-from-absolute
929 (calendar-absolute-from-gregorian 936 (calendar-absolute-from-gregorian
930 (if european-calendar-style 937 (if european-calendar-style
931 (list death-day death-month death-year) 938 (list death-day death-month death-year)
932 (list death-month death-day death-year))))) 939 (list death-month death-day death-year)))))
933 (h-month (extract-calendar-month h-date)) 940 (h-month (extract-calendar-month h-date))
934 (h-day (extract-calendar-day h-date)) 941 (h-day (extract-calendar-day h-date))
935 (h-year (extract-calendar-year h-date)) 942 (h-year (extract-calendar-year h-date))
@@ -938,18 +945,22 @@ order of the parameters is changed to DEATH-DAY, DEATH-MONTH, DEATH-YEAR."
938 (diff (- yr h-year)) 945 (diff (- yr h-year))
939 (y (hebrew-calendar-yahrzeit h-date yr))) 946 (y (hebrew-calendar-yahrzeit h-date yr)))
940 (if (and (> diff 0) (or (= y d) (= y (1+ d)))) 947 (if (and (> diff 0) (or (= y d) (= y (1+ d))))
941 (format "Yahrzeit of %s%s: %d%s anniversary" 948 (cons mark
942 entry 949 (format "Yahrzeit of %s%s: %d%s anniversary"
943 (if (= y d) "" " (evening)") 950 entry
944 diff 951 (if (= y d) "" " (evening)")
945 (cond ((= (% diff 10) 1) "st") 952 diff
946 ((= (% diff 10) 2) "nd") 953 (cond ((= (% diff 10) 1) "st")
947 ((= (% diff 10) 3) "rd") 954 ((= (% diff 10) 2) "nd")
948 (t "th")))))) 955 ((= (% diff 10) 3) "rd")
949 956 (t "th")))))))
950(defun diary-rosh-hodesh () 957
958(defun diary-rosh-hodesh (&optional mark)
951 "Rosh Hodesh diary entry. 959 "Rosh Hodesh diary entry.
952Entry applies if date is Rosh Hodesh, the day before, or the Saturday before." 960Entry applies if date is Rosh Hodesh, the day before, or the Saturday before.
961
962An optional parameter MARK specifies a face or single-character string to
963use when highlighting the day in the calendar."
953 (let* ((d (calendar-absolute-from-gregorian date)) 964 (let* ((d (calendar-absolute-from-gregorian date))
954 (h-date (calendar-hebrew-from-absolute d)) 965 (h-date (calendar-hebrew-from-absolute d))
955 (h-month (extract-calendar-month h-date)) 966 (h-month (extract-calendar-month h-date))
@@ -965,47 +976,52 @@ Entry applies if date is Rosh Hodesh, the day before, or the Saturday before."
965 (h-yesterday (extract-calendar-day 976 (h-yesterday (extract-calendar-day
966 (calendar-hebrew-from-absolute (1- d))))) 977 (calendar-hebrew-from-absolute (1- d)))))
967 (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)))
968 (format 979 (cons mark
969 "Rosh Hodesh %s" 980 (format
970 (if (= h-day 30) 981 "Rosh Hodesh %s"
971 (format 982 (if (= h-day 30)
972 "%s (first day)" 983 (format
973 ;; next month must be in the same year since this 984 "%s (first day)"
974 ;; month can't be the last month of the year since 985 ;; next month must be in the same year since this
975 ;; it has 30 days 986 ;; month can't be the last month of the year since
976 (aref h-month-names h-month)) 987 ;; it has 30 days
977 (if (= h-yesterday 30) 988 (aref h-month-names h-month))
978 (format "%s (second day)" this-month) 989 (if (= h-yesterday 30)
979 this-month))) 990 (format "%s (second day)" this-month)
980 (if (= (% d 7) 6);; Saturday--check for Shabbat Mevarchim 991 this-month))))
981 (cond ((and (> h-day 22) (/= h-month 6) (= 29 last-day)) 992 (if (= (% d 7) 6) ;; Saturday--check for Shabbat Mevarchim
982 (format "Mevarchim Rosh Hodesh %s (%s)" 993 (cons mark
983 (aref h-month-names 994 (cond ((and (> h-day 22) (/= h-month 6) (= 29 last-day))
984 (if (= h-month 995 (format "Mevarchim Rosh Hodesh %s (%s)"
985 (hebrew-calendar-last-month-of-year 996 (aref h-month-names
986 h-year)) 997 (if (= h-month
987 0 h-month)) 998 (hebrew-calendar-last-month-of-year
988 (aref calendar-day-name-array (- 29 h-day)))) 999 h-year))
989 ((and (< h-day 30) (> h-day 22) (= 30 last-day)) 1000 0 h-month))
990 (format "Mevarchim Rosh Hodesh %s (%s-%s)" 1001 (aref calendar-day-name-array (- 29 h-day))))
991 (aref h-month-names h-month) 1002 ((and (< h-day 30) (> h-day 22) (= 30 last-day))
992 (if (= h-day 29) 1003 (format "Mevarchim Rosh Hodesh %s (%s-%s)"
993 "tomorrow" 1004 (aref h-month-names h-month)
994 (aref calendar-day-name-array (- 29 h-day))) 1005 (if (= h-day 29)
995 (aref calendar-day-name-array 1006 "tomorrow"
996 (% (- 30 h-day) 7))))) 1007 (aref calendar-day-name-array (- 29 h-day)))
1008 (aref calendar-day-name-array
1009 (% (- 30 h-day) 7))))))
997 (if (and (= h-day 29) (/= h-month 6)) 1010 (if (and (= h-day 29) (/= h-month 6))
998 (format "Erev Rosh Hodesh %s" 1011 (cons (format "Erev Rosh Hodesh %s"
999 (aref h-month-names 1012 (aref h-month-names
1000 (if (= h-month 1013 (if (= h-month
1001 (hebrew-calendar-last-month-of-year 1014 (hebrew-calendar-last-month-of-year
1002 h-year)) 1015 h-year))
1003 0 h-month)))))))) 1016 0 h-month)))))))))
1004 1017
1005(defun diary-parasha () 1018(defun diary-parasha (&optional mark)
1006 "Parasha diary entry--entry applies if date is a Saturday." 1019 "Parasha diary entry--entry applies if date is a Saturday.
1020
1021An optional parameter MARK specifies a face or single-character string to
1022use when highlighting the day in the calendar."
1007 (let ((d (calendar-absolute-from-gregorian date))) 1023 (let ((d (calendar-absolute-from-gregorian date)))
1008 (if (= (% d 7) 6);; Saturday 1024 (if (= (% d 7) 6) ;; Saturday
1009 (let* 1025 (let*
1010 ((h-year (extract-calendar-year 1026 ((h-year (extract-calendar-year
1011 (calendar-hebrew-from-absolute d))) 1027 (calendar-hebrew-from-absolute d)))
@@ -1024,24 +1040,25 @@ Entry applies if date is Rosh Hodesh, the day before, or the Saturday before."
1024 (t "regular"))) 1040 (t "regular")))
1025 (year-format 1041 (year-format
1026 (symbol-value 1042 (symbol-value
1027 (intern (format "hebrew-calendar-year-%s-%s-%s";; keviah 1043 (intern (format "hebrew-calendar-year-%s-%s-%s" ;; keviah
1028 rosh-hashanah-day type passover-day)))) 1044 rosh-hashanah-day type passover-day))))
1029 (first-saturday;; of Hebrew year 1045 (first-saturday ;; of Hebrew year
1030 (calendar-dayname-on-or-before 6 (+ 6 rosh-hashanah))) 1046 (calendar-dayname-on-or-before 6 (+ 6 rosh-hashanah)))
1031 (saturday;; which Saturday of the Hebrew year 1047 (saturday ;; which Saturday of the Hebrew year
1032 (/ (- d first-saturday) 7)) 1048 (/ (- d first-saturday) 7))
1033 (parasha (aref year-format saturday))) 1049 (parasha (aref year-format saturday)))
1034 (if parasha 1050 (if parasha
1035 (format 1051 (cons mark
1036 "Parashat %s" 1052 (format
1037 (if (listp parasha);; Israel differs from diaspora 1053 "Parashat %s"
1038 (if (car parasha) 1054 (if (listp parasha) ;; Israel differs from diaspora
1039 (format "%s (diaspora), %s (Israel)" 1055 (if (car parasha)
1040 (hebrew-calendar-parasha-name (car parasha)) 1056 (format "%s (diaspora), %s (Israel)"
1041 (hebrew-calendar-parasha-name (cdr parasha))) 1057 (hebrew-calendar-parasha-name (car parasha))
1042 (format "%s (Israel)" 1058 (hebrew-calendar-parasha-name (cdr parasha)))
1043 (hebrew-calendar-parasha-name (cdr parasha)))) 1059 (format "%s (Israel)"
1044 (hebrew-calendar-parasha-name parasha)))))))) 1060 (hebrew-calendar-parasha-name (cdr parasha))))
1061 (hebrew-calendar-parasha-name parasha)))))))))
1045 1062
1046(defvar hebrew-calendar-parashiot-names 1063(defvar hebrew-calendar-parashiot-names
1047["Bereshith" "Noah" "Lech L'cha" "Vayera" "Hayei Sarah" "Toledoth" 1064["Bereshith" "Noah" "Lech L'cha" "Vayera" "Hayei Sarah" "Toledoth"