aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2002-07-22 15:32:00 +0000
committerRichard M. Stallman2002-07-22 15:32:00 +0000
commitfd4a98f021a928c4a34c13755073e8c5df911563 (patch)
tree4e523e65b47441b538eea01e2ab5fa092ea11b80
parent9a27723cd82078e5804bf91ce44597b49450a96f (diff)
downloademacs-fd4a98f021a928c4a34c13755073e8c5df911563.tar.gz
emacs-fd4a98f021a928c4a34c13755073e8c5df911563.zip
(mark-sexp-diary-entries): Retrieve mark
from diary-sexp-entry and pass it to mark-visible-calendar-date. (list-sexp-diary-entries): Update doc string for new docs for .... If diary-sexp-entry returns a cons, only add the text to the diary list. (diary-sexp-entry): Allow sexps to return a cons of the form (MARK . STRING) to specify what face or character mark should be used in the calendar display. (diary-date, diary-block, diary-float, diary-anniversary) (diary-cyclic): Add optional MARK parameter, specifying what face or character to use in the calendar display. These will now return (MARK . ENTRY). (check-calendar-holidays, diary-iso-date) (calendar-holiday-list, diary-french-date, diary-mayan-date) (diary-julian-date, diary-astro-day-number, diary-chinese-date) (diary-islamic-date, list-islamic-diary-entries) (mark-islamic-diary-entries, mark-islamic-calendar-date-pattern) (diary-hebrew-date, diary-omer, diary-yahrzeit, diary-parasha) (diary-rosh-hodesh, list-hebrew-diary-entries) (mark-hebrew-diary-entries, mark-hebrew-calendar-date-pattern) (diary-coptic-date, diary-persian-date, diary-phases-of-moon) (diary-sunrise-sunset, diary-sabbath-candles): Remove interactive flag from autoloads.
-rw-r--r--lisp/calendar/diary-lib.el185
1 files changed, 96 insertions, 89 deletions
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el
index 54d5dca80b8..9e8e6d4a3f3 100644
--- a/lisp/calendar/diary-lib.el
+++ b/lisp/calendar/diary-lib.el
@@ -88,108 +88,83 @@ three-month calendar."
88(autoload 'check-calendar-holidays "holidays" 88(autoload 'check-calendar-holidays "holidays"
89 "Check the list of holidays for any that occur on DATE. 89 "Check the list of holidays for any that occur on DATE.
90The value returned is a list of strings of relevant holiday descriptions. 90The value returned is a list of strings of relevant holiday descriptions.
91The holidays are those in the list `calendar-holidays'." 91The holidays are those in the list `calendar-holidays'.")
92 t)
93 92
94(autoload 'calendar-holiday-list "holidays" 93(autoload 'calendar-holiday-list "holidays"
95 "Form the list of holidays that occur on dates in the calendar window. 94 "Form the list of holidays that occur on dates in the calendar window.
96The holidays are those in the list `calendar-holidays'." 95The holidays are those in the list `calendar-holidays'.")
97 t)
98 96
99(autoload 'diary-french-date "cal-french" 97(autoload 'diary-french-date "cal-french"
100 "French calendar equivalent of date diary entry." 98 "French calendar equivalent of date diary entry.")
101 t)
102 99
103(autoload 'diary-mayan-date "cal-mayan" 100(autoload 'diary-mayan-date "cal-mayan"
104 "Mayan calendar equivalent of date diary entry." 101 "Mayan calendar equivalent of date diary entry.")
105 t)
106 102
107(autoload 'diary-iso-date "cal-iso" 103(autoload 'diary-iso-date "cal-iso"
108 "ISO calendar equivalent of date diary entry." 104 "ISO calendar equivalent of date diary entry.")
109 t)
110 105
111(autoload 'diary-julian-date "cal-julian" 106(autoload 'diary-julian-date "cal-julian"
112 "Julian calendar equivalent of date diary entry." 107 "Julian calendar equivalent of date diary entry.")
113 t)
114 108
115(autoload 'diary-astro-day-number "cal-julian" 109(autoload 'diary-astro-day-number "cal-julian"
116 "Astronomical (Julian) day number diary entry." 110 "Astronomical (Julian) day number diary entry.")
117 t)
118 111
119(autoload 'diary-chinese-date "cal-china" 112(autoload 'diary-chinese-date "cal-china"
120 "Chinese calendar equivalent of date diary entry." 113 "Chinese calendar equivalent of date diary entry.")
121 t)
122 114
123(autoload 'diary-islamic-date "cal-islam" 115(autoload 'diary-islamic-date "cal-islam"
124 "Islamic calendar equivalent of date diary entry." 116 "Islamic calendar equivalent of date diary entry.")
125 t)
126 117
127(autoload 'list-islamic-diary-entries "cal-islam" 118(autoload 'list-islamic-diary-entries "cal-islam"
128 "Add any Islamic date entries from the diary file to `diary-entries-list'." 119 "Add any Islamic date entries from the diary file to `diary-entries-list'.")
129 t)
130 120
131(autoload 'mark-islamic-diary-entries "cal-islam" 121(autoload 'mark-islamic-diary-entries "cal-islam"
132 "Mark days in the calendar window that have Islamic date diary entries." 122 "Mark days in the calendar window that have Islamic date diary entries.")
133 t)
134 123
135(autoload 'mark-islamic-calendar-date-pattern "cal-islam" 124(autoload 'mark-islamic-calendar-date-pattern "cal-islam"
136 "Mark dates in calendar window that conform to Islamic date MONTH/DAY/YEAR." 125 "Mark dates in calendar window that conform to Islamic date MONTH/DAY/YEAR.")
137 t)
138 126
139(autoload 'diary-hebrew-date "cal-hebrew" 127(autoload 'diary-hebrew-date "cal-hebrew"
140 "Hebrew calendar equivalent of date diary entry." 128 "Hebrew calendar equivalent of date diary entry.")
141 t)
142 129
143(autoload 'diary-omer "cal-hebrew" 130(autoload 'diary-omer "cal-hebrew"
144 "Omer count diary entry." 131 "Omer count diary entry.")
145 t)
146 132
147(autoload 'diary-yahrzeit "cal-hebrew" 133(autoload 'diary-yahrzeit "cal-hebrew"
148 "Yahrzeit diary entry--entry applies if date is yahrzeit or the day before." 134 "Yahrzeit diary entry--entry applies if date is yahrzeit or the day before.")
149 t)
150 135
151(autoload 'diary-parasha "cal-hebrew" 136(autoload 'diary-parasha "cal-hebrew"
152 "Parasha diary entry--entry applies if date is a Saturday." 137 "Parasha diary entry--entry applies if date is a Saturday.")
153 t)
154 138
155(autoload 'diary-rosh-hodesh "cal-hebrew" 139(autoload 'diary-rosh-hodesh "cal-hebrew"
156 "Rosh Hodesh diary entry." 140 "Rosh Hodesh diary entry.")
157 t)
158 141
159(autoload 'list-hebrew-diary-entries "cal-hebrew" 142(autoload 'list-hebrew-diary-entries "cal-hebrew"
160 "Add any Hebrew date entries from the diary file to `diary-entries-list'." 143 "Add any Hebrew date entries from the diary file to `diary-entries-list'.")
161 t)
162 144
163(autoload 'mark-hebrew-diary-entries "cal-hebrew" 145(autoload 'mark-hebrew-diary-entries "cal-hebrew"
164 "Mark days in the calendar window that have Hebrew date diary entries." 146 "Mark days in the calendar window that have Hebrew date diary entries.")
165 t)
166 147
167(autoload 'mark-hebrew-calendar-date-pattern "cal-hebrew" 148(autoload 'mark-hebrew-calendar-date-pattern "cal-hebrew"
168 "Mark dates in calendar window that conform to Hebrew date MONTH/DAY/YEAR." 149 "Mark dates in calendar window that conform to Hebrew date MONTH/DAY/YEAR.")
169 t)
170 150
171(autoload 'diary-coptic-date "cal-coptic" 151(autoload 'diary-coptic-date "cal-coptic"
172 "Coptic calendar equivalent of date diary entry." 152 "Coptic calendar equivalent of date diary entry.")
173 t)
174 153
175(autoload 'diary-ethiopic-date "cal-coptic" 154(autoload 'diary-ethiopic-date "cal-coptic"
176 "Ethiopic calendar equivalent of date diary entry." 155 "Ethiopic calendar equivalent of date diary entry.")
177 t)
178 156
179(autoload 'diary-persian-date "cal-persia" 157(autoload 'diary-persian-date "cal-persia"
180 "Persian calendar equivalent of date diary entry." 158 "Persian calendar equivalent of date diary entry.")
181 t)
182 159
183(autoload 'diary-phases-of-moon "lunar" "Moon phases diary entry." t) 160(autoload 'diary-phases-of-moon "lunar" "Moon phases diary entry.")
184 161
185(autoload 'diary-sunrise-sunset "solar" 162(autoload 'diary-sunrise-sunset "solar"
186 "Local time of sunrise and sunset as a diary entry." 163 "Local time of sunrise and sunset as a diary entry.")
187 t)
188 164
189(autoload 'diary-sabbath-candles "solar" 165(autoload 'diary-sabbath-candles "solar"
190 "Local time of candle lighting diary entry--applies if date is a Friday. 166 "Local time of candle lighting diary entry--applies if date is a Friday.
191No diary entry if there is no sunset on that date." 167No diary entry if there is no sunset on that date.")
192 t)
193 168
194(defvar diary-syntax-table (copy-syntax-table (standard-syntax-table)) 169(defvar diary-syntax-table (copy-syntax-table (standard-syntax-table))
195 "The syntax table used when parsing dates in the diary file. 170 "The syntax table used when parsing dates in the diary file.
@@ -808,7 +783,8 @@ is marked. See the documentation for the function `list-sexp-diary-entries'."
808 (m) 783 (m)
809 (y) 784 (y)
810 (first-date) 785 (first-date)
811 (last-date)) 786 (last-date)
787 (mark))
812 (save-excursion 788 (save-excursion
813 (set-buffer calendar-buffer) 789 (set-buffer calendar-buffer)
814 (setq m displayed-month) 790 (setq m displayed-month)
@@ -856,10 +832,12 @@ is marked. See the documentation for the function `list-sexp-diary-entries'."
856 (while (string-match "[\^M]" entry) 832 (while (string-match "[\^M]" entry)
857 (aset entry (match-beginning 0) ?\n ))) 833 (aset entry (match-beginning 0) ?\n )))
858 (calendar-for-loop date from first-date to last-date do 834 (calendar-for-loop date from first-date to last-date do
859 (if (diary-sexp-entry sexp entry 835 (if (setq mark (diary-sexp-entry sexp entry
860 (calendar-gregorian-from-absolute date)) 836 (calendar-gregorian-from-absolute date)))
861 (mark-visible-calendar-date 837 (mark-visible-calendar-date
862 (calendar-gregorian-from-absolute date)))))))) 838 (calendar-gregorian-from-absolute date)
839 (if (consp mark)
840 (car mark)))))))))
863 841
864(defun mark-included-diary-files () 842(defun mark-included-diary-files ()
865 "Mark the diary entries from other diary files with those of the diary file. 843 "Mark the diary entries from other diary files with those of the diary file.
@@ -965,9 +943,9 @@ after those with times."
965 :version "20.3") 943 :version "20.3")
966 944
967(defun diary-entry-time (s) 945(defun diary-entry-time (s)
968 "Time at the beginning of the string S in a military-style integer. For 946 "Return time at the beginning of the string S as a military-style integer.
969example, returns 1325 for 1:25pm. Returns `diary-unknown-time' (default value 947For example, returns 1325 for 1:25pm.
970-9999) if no time is recognized. The recognized forms are XXXX, X:XX, or 948Returns `diary-unknown-time' (default value -9999) if no time is recognized. The recognized forms are XXXX, X:XX, or
971XX:XX (military time), and XXam, XXAM, XXpm, XXPM, XX:XXam, XX:XXAM XX:XXpm, 949XX:XX (military time), and XXam, XXAM, XXpm, XXPM, XX:XXam, XX:XXAM XX:XXpm,
972or XX:XXPM." 950or XX:XXPM."
973 (let ((case-fold-search nil)) 951 (let ((case-fold-search nil))
@@ -1020,29 +998,35 @@ if it is a weekday and the Friday before if the 21st is on a weekend:
1020 998
1021A number of built-in functions are available for this type of diary entry: 999A number of built-in functions are available for this type of diary entry:
1022 1000
1023 %%(diary-date MONTH DAY YEAR) text 1001 %%(diary-date MONTH DAY YEAR &optional MARK) text
1024 Entry applies if date is MONTH, DAY, YEAR if 1002 Entry applies if date is MONTH, DAY, YEAR if
1025 `european-calendar-style' is nil, and DAY, MONTH, YEAR if 1003 `european-calendar-style' is nil, and DAY, MONTH, YEAR if
1026 `european-calendar-style' is t. DAY, MONTH, and YEAR 1004 `european-calendar-style' is t. DAY, MONTH, and YEAR
1027 can be lists of integers, the constant t, or an integer. 1005 can be lists of integers, the constant t, or an integer.
1028 The constant t means all values. 1006 The constant t means all values. An optional parameter
1007 MARK specifies a face or single-character string to use
1008 when highlighting the day in the calendar.
1029 1009
1030 %%(diary-float MONTH DAYNAME N &optional DAY) text 1010 %%(diary-float MONTH DAYNAME N &optional DAY MARK) text
1031 Entry will appear on the Nth DAYNAME of MONTH. 1011 Entry will appear on the Nth DAYNAME of MONTH.
1032 (DAYNAME=0 means Sunday, 1 means Monday, and so on; 1012 (DAYNAME=0 means Sunday, 1 means Monday, and so on;
1033 if N is negative it counts backward from the end of 1013 if N is negative it counts backward from the end of
1034 the month. MONTH can be a list of months, a single 1014 the month. MONTH can be a list of months, a single
1035 month, or t to specify all months. Optional DAY means 1015 month, or t to specify all months. Optional DAY means
1036 Nth DAYNAME of MONTH on or after/before DAY. DAY defaults 1016 Nth DAYNAME of MONTH on or after/before DAY. DAY defaults
1037 to 1 if N>0 and the last day of the month if N<0. 1017 to 1 if N>0 and the last day of the month if N<0. An
1018 optional parameter MARK specifies a face or single-character
1019 string to use when highlighting the day in the calendar.
1038 1020
1039 %%(diary-block M1 D1 Y1 M2 D2 Y2) text 1021 %%(diary-block M1 D1 Y1 M2 D2 Y2 &optional MARK) text
1040 Entry will appear on dates between M1/D1/Y1 and M2/D2/Y2, 1022 Entry will appear on dates between M1/D1/Y1 and M2/D2/Y2,
1041 inclusive. (If `european-calendar-style' is t, the 1023 inclusive. (If `european-calendar-style' is t, the
1042 order of the parameters should be changed to D1, M1, Y1, 1024 order of the parameters should be changed to D1, M1, Y1,
1043 D2, M2, Y2.) 1025 D2, M2, Y2.) An optional parameter MARK specifies a face
1026 or single-character string to use when highlighting the
1027 day in the calendar.
1044 1028
1045 %%(diary-anniversary MONTH DAY YEAR) text 1029 %%(diary-anniversary MONTH DAY YEAR &optional MARK) text
1046 Entry will appear on anniversary dates of MONTH DAY, YEAR. 1030 Entry will appear on anniversary dates of MONTH DAY, YEAR.
1047 (If `european-calendar-style' is t, the order of the 1031 (If `european-calendar-style' is t, the order of the
1048 parameters should be changed to DAY, MONTH, YEAR.) Text 1032 parameters should be changed to DAY, MONTH, YEAR.) Text
@@ -1050,16 +1034,20 @@ A number of built-in functions are available for this type of diary entry:
1050 of years since the MONTH DAY, YEAR and %s will be replaced 1034 of years since the MONTH DAY, YEAR and %s will be replaced
1051 by the ordinal ending of that number (that is, `st', `nd', 1035 by the ordinal ending of that number (that is, `st', `nd',
1052 `rd' or `th', as appropriate. The anniversary of February 1036 `rd' or `th', as appropriate. The anniversary of February
1053 29 is considered to be March 1 in a non-leap year. 1037 29 is considered to be March 1 in a non-leap year. An
1038 optional parameter MARK specifies a face or single-character
1039 string to use when highlighting the day in the calendar.
1054 1040
1055 %%(diary-cyclic N MONTH DAY YEAR) text 1041 %%(diary-cyclic N MONTH DAY YEAR &optional MARK) text
1056 Entry will appear every N days, starting MONTH DAY, YEAR. 1042 Entry will appear every N days, starting MONTH DAY, YEAR.
1057 (If `european-calendar-style' is t, the order of the 1043 (If `european-calendar-style' is t, the order of the
1058 parameters should be changed to N, DAY, MONTH, YEAR.) Text 1044 parameters should be changed to N, DAY, MONTH, YEAR.) Text
1059 can contain %d or %d%s; %d will be replaced by the number 1045 can contain %d or %d%s; %d will be replaced by the number
1060 of repetitions since the MONTH DAY, YEAR and %s will 1046 of repetitions since the MONTH DAY, YEAR and %s will
1061 be replaced by the ordinal ending of that number (that is, 1047 be replaced by the ordinal ending of that number (that is,
1062 `st', `nd', `rd' or `th', as appropriate. 1048 `st', `nd', `rd' or `th', as appropriate. An optional
1049 parameter MARK specifies a face or single-character string
1050 to use when highlighting the day in the calendar.
1063 1051
1064 %%(diary-remind SEXP DAYS &optional MARKING) text 1052 %%(diary-remind SEXP DAYS &optional MARKING) text
1065 Entry is a reminder for diary sexp SEXP. DAYS is either a 1053 Entry is a reminder for diary sexp SEXP. DAYS is either a
@@ -1184,8 +1172,12 @@ best if they are nonmarking."
1184 (let ((diary-entry (diary-sexp-entry sexp entry date))) 1172 (let ((diary-entry (diary-sexp-entry sexp entry date)))
1185 (if diary-entry 1173 (if diary-entry
1186 (subst-char-in-region line-start (point) ?\^M ?\n t)) 1174 (subst-char-in-region line-start (point) ?\^M ?\n t))
1187 (add-to-diary-list date diary-entry specifier) 1175 (add-to-diary-list date
1188 (setq entry-found (or entry-found diary-entry))))) 1176 (if (consp diary-entry)
1177 (cdr diary-entry)
1178 diary-entry)
1179 specifier)
1180 (setq entry-found (or entry-found diary-entry)))))
1189 entry-found)) 1181 entry-found))
1190 1182
1191(defun diary-sexp-entry (sexp entry date) 1183(defun diary-sexp-entry (sexp entry date)
@@ -1208,18 +1200,21 @@ best if they are nonmarking."
1208 lines))) 1200 lines)))
1209 diary-file sexp) 1201 diary-file sexp)
1210 (sleep-for 2)))))) 1202 (sleep-for 2))))))
1211 (if (stringp result) 1203 (cond ((stringp result) result)
1212 result 1204 ((and (consp result)
1213 (if result 1205 (stringp (cdr result))) result)
1214 entry 1206 (result entry)
1215 nil)))) 1207 (t nil))))
1216 1208
1217(defun diary-date (month day year) 1209(defun diary-date (month day year &optional mark)
1218 "Specific date(s) diary entry. 1210 "Specific date(s) diary entry.
1219Entry applies if date is MONTH, DAY, YEAR if `european-calendar-style' is nil, 1211Entry applies if date is MONTH, DAY, YEAR if `european-calendar-style' is nil,
1220and DAY, MONTH, YEAR if `european-calendar-style' is t. DAY, MONTH, and YEAR 1212and DAY, MONTH, YEAR if `european-calendar-style' is t. DAY, MONTH, and YEAR
1221can be lists of integers, the constant t, or an integer. The constant t means 1213can be lists of integers, the constant t, or an integer. The constant t means
1222all values." 1214all values.
1215
1216An optional parameter MARK specifies a face or single-character string to
1217use when highlighting the day in the calendar."
1223 (let* ((dd (if european-calendar-style 1218 (let* ((dd (if european-calendar-style
1224 month 1219 month
1225 day)) 1220 day))
@@ -1241,12 +1236,16 @@ all values."
1241 (eq year t))) 1236 (eq year t)))
1242 entry))) 1237 entry)))
1243 1238
1244(defun diary-block (m1 d1 y1 m2 d2 y2) 1239(defun diary-block (m1 d1 y1 m2 d2 y2 &optional mark)
1245 "Block diary entry. 1240 "Block diary entry.
1246Entry applies if date is between, or on one of, two dates. 1241Entry applies if date is between, or on one of, two dates.
1247The order of the parameters is 1242The order of the parameters is
1248M1, D1, Y1, M2, D2, Y2 if `european-calendar-style' is nil, and 1243M1, D1, Y1, M2, D2, Y2 if `european-calendar-style' is nil, and
1249D1, M1, Y1, D2, M2, Y2 if `european-calendar-style' is t." 1244D1, M1, Y1, D2, M2, Y2 if `european-calendar-style' is t.
1245
1246An optional parameter MARK specifies a face or single-character string to
1247use when highlighting the day in the calendar."
1248
1250 (let ((date1 (calendar-absolute-from-gregorian 1249 (let ((date1 (calendar-absolute-from-gregorian
1251 (if european-calendar-style 1250 (if european-calendar-style
1252 (list d1 m1 y1) 1251 (list d1 m1 y1)
@@ -1257,15 +1256,17 @@ D1, M1, Y1, D2, M2, Y2 if `european-calendar-style' is t."
1257 (list m2 d2 y2)))) 1256 (list m2 d2 y2))))
1258 (d (calendar-absolute-from-gregorian date))) 1257 (d (calendar-absolute-from-gregorian date)))
1259 (if (and (<= date1 d) (<= d date2)) 1258 (if (and (<= date1 d) (<= d date2))
1260 entry))) 1259 (cons mark entry))))
1261 1260
1262(defun diary-float (month dayname n &optional day) 1261(defun diary-float (month dayname n &optional day mark)
1263 "Floating diary entry--entry applies if date is the nth dayname of month. 1262 "Floating diary entry--entry applies if date is the nth dayname of month.
1264Parameters are MONTH, DAYNAME, N. MONTH can be a list of months, the constant 1263Parameters are MONTH, DAYNAME, N. MONTH can be a list of months, the constant
1265t, or an integer. The constant t means all months. If N is negative, count 1264t, or an integer. The constant t means all months. If N is negative, count
1266backward from the end of the month. 1265backward from the end of the month.
1267 1266
1268An optional parameter DAY means the Nth DAYNAME on or after/before MONTH DAY." 1267An optional parameter DAY means the Nth DAYNAME on or after/before MONTH DAY.
1268Optional MARK specifies a face or single-character string to use when
1269highlighting the day in the calendar."
1269;; This is messy because the diary entry may apply, but the date on which it 1270;; This is messy because the diary entry may apply, but the date on which it
1270;; is based can be in a different month/year. For example, asking for the 1271;; is based can be in a different month/year. For example, asking for the
1271;; first Monday after December 30. For large values of |n| the problem is 1272;; first Monday after December 30. For large values of |n| the problem is
@@ -1319,10 +1320,10 @@ An optional parameter DAY means the Nth DAYNAME on or after/before MONTH DAY."
1319 1 1320 1
1320 (calendar-last-day-of-month m2 y2))) 1321 (calendar-last-day-of-month m2 y2)))
1321 d2))))) 1322 d2)))))
1322 entry)))) 1323 (cons mark entry)))))
1323 1324
1324 1325
1325(defun diary-anniversary (month day year) 1326(defun diary-anniversary (month day year &optional mark)
1326 "Anniversary diary entry. 1327 "Anniversary diary entry.
1327Entry applies if date is the anniversary of MONTH, DAY, YEAR if 1328Entry applies if date is the anniversary of MONTH, DAY, YEAR if
1328`european-calendar-style' is nil, and DAY, MONTH, YEAR if 1329`european-calendar-style' is nil, and DAY, MONTH, YEAR if
@@ -1330,7 +1331,10 @@ Entry applies if date is the anniversary of MONTH, DAY, YEAR if
1330%d will be replaced by the number of years since the MONTH DAY, YEAR and the 1331%d will be replaced by the number of years since the MONTH DAY, YEAR and the
1331%s will be replaced by the ordinal ending of that number (that is, `st', `nd', 1332%s will be replaced by the ordinal ending of that number (that is, `st', `nd',
1332`rd' or `th', as appropriate. The anniversary of February 29 is considered 1333`rd' or `th', as appropriate. The anniversary of February 29 is considered
1333to be March 1 in non-leap years." 1334to be March 1 in non-leap years.
1335
1336An optional parameter MARK specifies a face or single-character string to
1337use when highlighting the day in the calendar."
1334 (let* ((d (if european-calendar-style 1338 (let* ((d (if european-calendar-style
1335 month 1339 month
1336 day)) 1340 day))
@@ -1343,15 +1347,18 @@ to be March 1 in non-leap years."
1343 (setq m 3 1347 (setq m 3
1344 d 1)) 1348 d 1))
1345 (if (and (> diff 0) (calendar-date-equal (list m d y) date)) 1349 (if (and (> diff 0) (calendar-date-equal (list m d y) date))
1346 (format entry diff (diary-ordinal-suffix diff))))) 1350 (cons mark (format entry diff (diary-ordinal-suffix diff))))))
1347 1351
1348(defun diary-cyclic (n month day year) 1352(defun diary-cyclic (n month day year &optional mark)
1349 "Cycle diary entry--entry applies every N days starting at MONTH, DAY, YEAR. 1353 "Cycle diary entry--entry applies every N days starting at MONTH, DAY, YEAR.
1350If `european-calendar-style' is t, parameters are N, DAY, MONTH, YEAR. 1354If `european-calendar-style' is t, parameters are N, DAY, MONTH, YEAR.
1351ENTRY can contain `%d' or `%d%s'; the %d will be replaced by the number of 1355ENTRY can contain `%d' or `%d%s'; the %d will be replaced by the number of
1352repetitions since the MONTH DAY, YEAR and %s will be replaced by the 1356repetitions since the MONTH DAY, YEAR and %s will be replaced by the
1353ordinal ending of that number (that is, `st', `nd', `rd' or `th', as 1357ordinal ending of that number (that is, `st', `nd', `rd' or `th', as
1354appropriate." 1358appropriate.
1359
1360An optional parameter MARK specifies a face or single-character string to
1361use when highlighting the day in the calendar."
1355 (let* ((d (if european-calendar-style 1362 (let* ((d (if european-calendar-style
1356 month 1363 month
1357 day)) 1364 day))
@@ -1363,7 +1370,7 @@ appropriate."
1363 (list m d year)))) 1370 (list m d year))))
1364 (cycle (/ diff n))) 1371 (cycle (/ diff n)))
1365 (if (and (>= diff 0) (zerop (% diff n))) 1372 (if (and (>= diff 0) (zerop (% diff n)))
1366 (format entry cycle (diary-ordinal-suffix cycle))))) 1373 (cons mark (format entry cycle (diary-ordinal-suffix cycle))))))
1367 1374
1368(defun diary-ordinal-suffix (n) 1375(defun diary-ordinal-suffix (n)
1369 "Ordinal suffix for N. (That is, `st', `nd', `rd', or `th', as appropriate.)" 1376 "Ordinal suffix for N. (That is, `st', `nd', `rd', or `th', as appropriate.)"