| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
(defvar displayed-month) |
|---|
| 51 |
(defvar displayed-year) |
|---|
| 52 |
|
|---|
| 53 |
(require 'calendar) |
|---|
| 54 |
|
|---|
| 55 |
(autoload 'holiday-julian "cal-julian" |
|---|
| 56 |
"Holiday on MONTH, DAY (Julian) called STRING." |
|---|
| 57 |
t) |
|---|
| 58 |
|
|---|
| 59 |
(autoload 'holiday-hebrew "cal-hebrew" |
|---|
| 60 |
"Holiday on MONTH, DAY (Hebrew) called STRING." |
|---|
| 61 |
t) |
|---|
| 62 |
|
|---|
| 63 |
(autoload 'holiday-rosh-hashanah-etc "cal-hebrew" |
|---|
| 64 |
"List of dates related to Rosh Hashanah, as visible in calendar window." |
|---|
| 65 |
t) |
|---|
| 66 |
|
|---|
| 67 |
(autoload 'holiday-hanukkah "cal-hebrew" |
|---|
| 68 |
"List of dates related to Hanukkah, as visible in calendar window." |
|---|
| 69 |
t) |
|---|
| 70 |
|
|---|
| 71 |
(autoload 'holiday-passover-etc "cal-hebrew" |
|---|
| 72 |
"List of dates related to Passover, as visible in calendar window." |
|---|
| 73 |
t) |
|---|
| 74 |
|
|---|
| 75 |
(autoload 'holiday-tisha-b-av-etc "cal-hebrew" |
|---|
| 76 |
"List of dates around Tisha B'Av, as visible in calendar window." |
|---|
| 77 |
t) |
|---|
| 78 |
|
|---|
| 79 |
(autoload 'holiday-islamic "cal-islam" |
|---|
| 80 |
"Holiday on MONTH, DAY (Islamic) called STRING." |
|---|
| 81 |
t) |
|---|
| 82 |
|
|---|
| 83 |
(autoload 'holiday-bahai "cal-bahai" |
|---|
| 84 |
"Holiday on MONTH, DAY (Baha'i) called STRING." |
|---|
| 85 |
t) |
|---|
| 86 |
|
|---|
| 87 |
(autoload 'holiday-chinese-new-year "cal-china" |
|---|
| 88 |
"Date of Chinese New Year." |
|---|
| 89 |
t) |
|---|
| 90 |
|
|---|
| 91 |
(autoload 'solar-equinoxes-solstices "solar" |
|---|
| 92 |
"Date and time of equinoxes and solstices, if visible in the calendar window. |
|---|
| 93 |
Requires floating point." |
|---|
| 94 |
t) |
|---|
| 95 |
|
|---|
| 96 |
|
|---|
| 97 |
(defun holidays (&optional arg) |
|---|
| 98 |
"Display the holidays for last month, this month, and next month. |
|---|
| 99 |
If called with an optional prefix argument, prompts for month and year. |
|---|
| 100 |
|
|---|
| 101 |
This function is suitable for execution in a .emacs file." |
|---|
| 102 |
(interactive "P") |
|---|
| 103 |
(save-excursion |
|---|
| 104 |
(let* ((completion-ignore-case t) |
|---|
| 105 |
(date (if arg |
|---|
| 106 |
(calendar-read-date t) |
|---|
| 107 |
(calendar-current-date))) |
|---|
| 108 |
(displayed-month (extract-calendar-month date)) |
|---|
| 109 |
(displayed-year (extract-calendar-year date))) |
|---|
| 110 |
(list-calendar-holidays)))) |
|---|
| 111 |
|
|---|
| 112 |
|
|---|
| 113 |
(defun list-holidays (y1 y2 &optional l label) |
|---|
| 114 |
"Display holidays for years Y1 to Y2 (inclusive). |
|---|
| 115 |
|
|---|
| 116 |
The optional list of holidays L defaults to `calendar-holidays'. |
|---|
| 117 |
If you want to control what holidays are displayed, use a |
|---|
| 118 |
different list. For example, |
|---|
| 119 |
|
|---|
| 120 |
(list-holidays 2006 2006 |
|---|
| 121 |
(append general-holidays local-holidays other-holidays)) |
|---|
| 122 |
|
|---|
| 123 |
will display holidays for the year 2006 defined in the 3 |
|---|
| 124 |
mentioned lists, and nothing else. |
|---|
| 125 |
|
|---|
| 126 |
When called interactively, this command offers a choice of |
|---|
| 127 |
holidays, based on the variables `solar-holidays' etc. See the |
|---|
| 128 |
documentation of `calendar-holidays' for a list of the variables |
|---|
| 129 |
that control the choices, as well as a description of the format |
|---|
| 130 |
of a holiday list. |
|---|
| 131 |
|
|---|
| 132 |
The optional LABEL is used to label the buffer created." |
|---|
| 133 |
(interactive |
|---|
| 134 |
(let* ((start-year (calendar-read |
|---|
| 135 |
"Starting year of holidays (>0): " |
|---|
| 136 |
'(lambda (x) (> x 0)) |
|---|
| 137 |
(int-to-string (extract-calendar-year |
|---|
| 138 |
(calendar-current-date))))) |
|---|
| 139 |
(end-year (calendar-read |
|---|
| 140 |
(format "Ending year (inclusive) of holidays (>=%s): " |
|---|
| 141 |
start-year) |
|---|
| 142 |
'(lambda (x) (>= x start-year)) |
|---|
| 143 |
(int-to-string start-year))) |
|---|
| 144 |
(completion-ignore-case t) |
|---|
| 145 |
(lists |
|---|
| 146 |
(list |
|---|
| 147 |
(cons "All" calendar-holidays) |
|---|
| 148 |
(if (fboundp 'atan) |
|---|
| 149 |
(cons "Equinoxes/Solstices" |
|---|
| 150 |
(list (list 'solar-equinoxes-solstices)))) |
|---|
| 151 |
(if general-holidays (cons "General" general-holidays)) |
|---|
| 152 |
(if local-holidays (cons "Local" local-holidays)) |
|---|
| 153 |
(if other-holidays (cons "Other" other-holidays)) |
|---|
| 154 |
(if christian-holidays (cons "Christian" christian-holidays)) |
|---|
| 155 |
(if hebrew-holidays (cons "Hebrew" hebrew-holidays)) |
|---|
| 156 |
(if islamic-holidays (cons "Islamic" islamic-holidays)) |
|---|
| 157 |
(if bahai-holidays (cons "Baha'i" bahai-holidays)) |
|---|
| 158 |
(if oriental-holidays (cons "Oriental" oriental-holidays)) |
|---|
| 159 |
(if solar-holidays (cons "Solar" solar-holidays)) |
|---|
| 160 |
(cons "Ask" nil))) |
|---|
| 161 |
(choice (capitalize |
|---|
| 162 |
(completing-read "List (TAB for choices): " lists nil t))) |
|---|
| 163 |
(which (if (string-equal choice "Ask") |
|---|
| 164 |
(eval (read-variable "Enter list name: ")) |
|---|
| 165 |
(cdr (assoc choice lists)))) |
|---|
| 166 |
(name (if (string-equal choice "Equinoxes/Solstices") |
|---|
| 167 |
choice |
|---|
| 168 |
(if (member choice '("Ask" "")) |
|---|
| 169 |
"Holidays" |
|---|
| 170 |
(format "%s Holidays" choice))))) |
|---|
| 171 |
(list start-year end-year which name))) |
|---|
| 172 |
(message "Computing holidays...") |
|---|
| 173 |
(let* ((holiday-buffer "*Holidays*") |
|---|
| 174 |
(calendar-holidays (if l l calendar-holidays)) |
|---|
| 175 |
(title (or label "Holidays")) |
|---|
| 176 |
(holiday-list nil) |
|---|
| 177 |
(s (calendar-absolute-from-gregorian (list 2 1 y1))) |
|---|
| 178 |
(e (calendar-absolute-from-gregorian (list 11 1 y2))) |
|---|
| 179 |
(d s) |
|---|
| 180 |
(never t) |
|---|
| 181 |
(displayed-month 2) |
|---|
| 182 |
(displayed-year y1)) |
|---|
| 183 |
(while (or never (<= d e)) |
|---|
| 184 |
(setq holiday-list (append holiday-list (calendar-holiday-list))) |
|---|
| 185 |
(setq never nil) |
|---|
| 186 |
(increment-calendar-month displayed-month displayed-year 3) |
|---|
| 187 |
(setq d (calendar-absolute-from-gregorian |
|---|
| 188 |
(list displayed-month 1 displayed-year)))) |
|---|
| 189 |
(save-excursion |
|---|
| 190 |
(set-buffer (get-buffer-create holiday-buffer)) |
|---|
| 191 |
(setq buffer-read-only nil) |
|---|
| 192 |
(calendar-set-mode-line |
|---|
| 193 |
(if (= y1 y2) |
|---|
| 194 |
(format "%s for %s" title y1) |
|---|
| 195 |
(format "%s for %s-%s" title y1 y2))) |
|---|
| 196 |
(erase-buffer) |
|---|
| 197 |
(goto-char (point-min)) |
|---|
| 198 |
(insert |
|---|
| 199 |
(mapconcat |
|---|
| 200 |
'(lambda (x) (concat (calendar-date-string (car x)) |
|---|
| 201 |
": " (car (cdr x)))) |
|---|
| 202 |
holiday-list "\n")) |
|---|
| 203 |
(goto-char (point-min)) |
|---|
| 204 |
(set-buffer-modified-p nil) |
|---|
| 205 |
(setq buffer-read-only t) |
|---|
| 206 |
(display-buffer holiday-buffer) |
|---|
| 207 |
(message "Computing holidays...done")))) |
|---|
| 208 |
|
|---|
| 209 |
|
|---|
| 210 |
(defun check-calendar-holidays (date) |
|---|
| 211 |
"Check the list of holidays for any that occur on DATE. |
|---|
| 212 |
The value returned is a list of strings of relevant holiday descriptions. |
|---|
| 213 |
The holidays are those in the list calendar-holidays." |
|---|
| 214 |
(let* ((displayed-month (extract-calendar-month date)) |
|---|
| 215 |
(displayed-year (extract-calendar-year date)) |
|---|
| 216 |
(h (calendar-holiday-list)) |
|---|
| 217 |
(holiday-list)) |
|---|
| 218 |
(while h |
|---|
| 219 |
(if (calendar-date-equal date (car (car h))) |
|---|
| 220 |
(setq holiday-list (append holiday-list (cdr (car h))))) |
|---|
| 221 |
(setq h (cdr h))) |
|---|
| 222 |
holiday-list)) |
|---|
| 223 |
|
|---|
| 224 |
(defun calendar-cursor-holidays () |
|---|
| 225 |
"Find holidays for the date specified by the cursor in the calendar window." |
|---|
| 226 |
(interactive) |
|---|
| 227 |
(message "Checking holidays...") |
|---|
| 228 |
(let* ((date (calendar-cursor-to-date t)) |
|---|
| 229 |
(date-string (calendar-date-string date)) |
|---|
| 230 |
(holiday-list (check-calendar-holidays date)) |
|---|
| 231 |
(holiday-string (mapconcat 'identity holiday-list "; ")) |
|---|
| 232 |
(msg (format "%s: %s" date-string holiday-string))) |
|---|
| 233 |
(if (not holiday-list) |
|---|
| 234 |
(message "No holidays known for %s" date-string) |
|---|
| 235 |
(if (<= (length msg) (frame-width)) |
|---|
| 236 |
(message "%s" msg) |
|---|
| 237 |
(set-buffer (get-buffer-create holiday-buffer)) |
|---|
| 238 |
(setq buffer-read-only nil) |
|---|
| 239 |
(calendar-set-mode-line date-string) |
|---|
| 240 |
(erase-buffer) |
|---|
| 241 |
(insert (mapconcat 'identity holiday-list "\n")) |
|---|
| 242 |
(goto-char (point-min)) |
|---|
| 243 |
(set-buffer-modified-p nil) |
|---|
| 244 |
(setq buffer-read-only t) |
|---|
| 245 |
(display-buffer holiday-buffer) |
|---|
| 246 |
(message "Checking holidays...done"))))) |
|---|
| 247 |
|
|---|
| 248 |
(defun mark-calendar-holidays () |
|---|
| 249 |
"Mark notable days in the calendar window." |
|---|
| 250 |
(interactive) |
|---|
| 251 |
(setq mark-holidays-in-calendar t) |
|---|
| 252 |
(message "Marking holidays...") |
|---|
| 253 |
(let ((holiday-list (calendar-holiday-list))) |
|---|
| 254 |
(while holiday-list |
|---|
| 255 |
(mark-visible-calendar-date |
|---|
| 256 |
(car (car holiday-list)) calendar-holiday-marker) |
|---|
| 257 |
(setq holiday-list (cdr holiday-list)))) |
|---|
| 258 |
(message "Marking holidays...done")) |
|---|
| 259 |
|
|---|
| 260 |
(defun list-calendar-holidays () |
|---|
| 261 |
"Create a buffer containing the holidays for the current calendar window. |
|---|
| 262 |
The holidays are those in the list calendar-notable-days. Returns t if any |
|---|
| 263 |
holidays are found, nil if not." |
|---|
| 264 |
(interactive) |
|---|
| 265 |
(message "Looking up holidays...") |
|---|
| 266 |
(let ((holiday-list (calendar-holiday-list)) |
|---|
| 267 |
(m1 displayed-month) |
|---|
| 268 |
(y1 displayed-year) |
|---|
| 269 |
(m2 displayed-month) |
|---|
| 270 |
(y2 displayed-year)) |
|---|
| 271 |
(if (not holiday-list) |
|---|
| 272 |
(progn |
|---|
| 273 |
(message "Looking up holidays...none found") |
|---|
| 274 |
nil) |
|---|
| 275 |
(set-buffer (get-buffer-create holiday-buffer)) |
|---|
| 276 |
(setq buffer-read-only nil) |
|---|
| 277 |
(increment-calendar-month m1 y1 -1) |
|---|
| 278 |
(increment-calendar-month m2 y2 1) |
|---|
| 279 |
(calendar-set-mode-line |
|---|
| 280 |
(if (= y1 y2) |
|---|
| 281 |
(format "Notable Dates from %s to %s, %d%%-" |
|---|
| 282 |
(calendar-month-name m1) (calendar-month-name m2) y2) |
|---|
| 283 |
(format "Notable Dates from %s, %d to %s, %d%%-" |
|---|
| 284 |
(calendar-month-name m1) y1 (calendar-month-name m2) y2))) |
|---|
| 285 |
(erase-buffer) |
|---|
| 286 |
(insert |
|---|
| 287 |
(mapconcat |
|---|
| 288 |
'(lambda (x) (concat (calendar-date-string (car x)) |
|---|
| 289 |
": " (car (cdr x)))) |
|---|
| 290 |
holiday-list "\n")) |
|---|
| 291 |
(goto-char (point-min)) |
|---|
| 292 |
(set-buffer-modified-p nil) |
|---|
| 293 |
(setq buffer-read-only t) |
|---|
| 294 |
(display-buffer holiday-buffer) |
|---|
| 295 |
(message "Looking up holidays...done") |
|---|
| 296 |
t))) |
|---|
| 297 |
|
|---|
| 298 |
(defun calendar-holiday-list () |
|---|
| 299 |
"Form the list of holidays that occur on dates in the calendar window. |
|---|
| 300 |
The holidays are those in the list calendar-holidays." |
|---|
| 301 |
(let ((p calendar-holidays) |
|---|
| 302 |
(holiday-list)) |
|---|
| 303 |
(while p |
|---|
| 304 |
(let* ((holidays |
|---|
| 305 |
(if calendar-debug-sexp |
|---|
| 306 |
(let ((stack-trace-on-error t)) |
|---|
| 307 |
(eval (car p))) |
|---|
| 308 |
(condition-case nil |
|---|
| 309 |
(eval (car p)) |
|---|
| 310 |
(error (beep) |
|---|
| 311 |
(message "Bad holiday list item: %s" (car p)) |
|---|
| 312 |
(sleep-for 2)))))) |
|---|
| 313 |
(if holidays |
|---|
| 314 |
(setq holiday-list (append holidays holiday-list)))) |
|---|
| 315 |
(setq p (cdr p))) |
|---|
| 316 |
(setq holiday-list (sort holiday-list 'calendar-date-compare)))) |
|---|
| 317 |
|
|---|
| 318 |
|
|---|
| 319 |
|
|---|
| 320 |
|
|---|
| 321 |
|
|---|
| 322 |
|
|---|
| 323 |
|
|---|
| 324 |
(defun holiday-fixed (month day string) |
|---|
| 325 |
"Holiday on MONTH, DAY (Gregorian) called STRING. |
|---|
| 326 |
If MONTH, DAY is visible, the value returned is the list (((MONTH DAY year) |
|---|
| 327 |
STRING)). Returns nil if it is not visible in the current calendar window." |
|---|
| 328 |
(let ((m displayed-month) |
|---|
| 329 |
(y displayed-year)) |
|---|
| 330 |
(increment-calendar-month m y (- 11 month)) |
|---|
| 331 |
(if (> m 9) |
|---|
| 332 |
(list (list (list month day y) string))))) |
|---|
| 333 |
|
|---|
| 334 |
(defun holiday-float (month dayname n string &optional day) |
|---|
| 335 |
"Holiday on MONTH, DAYNAME (Nth occurrence) called STRING. |
|---|
| 336 |
If the Nth DAYNAME in MONTH is visible, the value returned is the list |
|---|
| 337 |
\(((MONTH DAY year) STRING)). |
|---|
| 338 |
|
|---|
| 339 |
If N<0, count backward from the end of MONTH. |
|---|
| 340 |
|
|---|
| 341 |
An optional parameter DAY means the Nth DAYNAME on or after/before MONTH DAY. |
|---|
| 342 |
|
|---|
| 343 |
Returns nil if it is not visible in the current calendar window." |
|---|
| 344 |
|
|---|
| 345 |
|
|---|
| 346 |
|
|---|
| 347 |
|
|---|
| 348 |
|
|---|
| 349 |
|
|---|
| 350 |
|
|---|
| 351 |
|
|---|
| 352 |
|
|---|
| 353 |
|
|---|
| 354 |
|
|---|
| 355 |
|
|---|
| 356 |
|
|---|
| 357 |
(let* ((m1 displayed-month) |
|---|
| 358 |
(y1 displayed-year) |
|---|
| 359 |
(m2 m1) |
|---|
| 360 |
(y2 y1)) |
|---|
| 361 |
(increment-calendar-month m1 y1 -1) |
|---|
| 362 |
(increment-calendar-month m2 y2 1) |
|---|
| 363 |
(let* ((d1 |
|---|
| 364 |
(+ (calendar-nth-named-absday 1 dayname m1 y1) |
|---|
| 365 |
(* -7 n) |
|---|
| 366 |
(if (> n 0) 1 -7))) |
|---|
| 367 |
(d2 |
|---|
| 368 |
(+ (calendar-nth-named-absday -1 dayname m2 y2) |
|---|
| 369 |
(* -7 n) |
|---|
| 370 |
(if (> n 0) 7 -1))) |
|---|
| 371 |
(y1 (extract-calendar-year (calendar-gregorian-from-absolute d1))) |
|---|
| 372 |
(y2 (extract-calendar-year (calendar-gregorian-from-absolute d2))) |
|---|
| 373 |
(y |
|---|
| 374 |
(if (or (= y1 y2) (> month 9)) |
|---|
| 375 |
y1 |
|---|
| 376 |
y2)) |
|---|
| 377 |
(d |
|---|
| 378 |
(or day (if (> n 0) |
|---|
| 379 |
1 |
|---|
| 380 |
(calendar-last-day-of-month month y)))) |
|---|
| 381 |
(date |
|---|
| 382 |
(calendar-absolute-from-gregorian (list month d y)))) |
|---|
| 383 |
(if (and (<= d1 date) (<= date d2)) |
|---|
| 384 |
(list (list (calendar-nth-named-day n dayname month y d) |
|---|
| 385 |
string)))))) |
|---|
| 386 |
|
|---|
| 387 |
(defun holiday-sexp (sexp string) |
|---|
| 388 |
"Sexp holiday for dates in the calendar window. |
|---|
| 389 |
SEXP is an expression in variable `year' evaluates to `date'. |
|---|
| 390 |
|
|---|
| 391 |
STRING is an expression in `date' that evaluates to the holiday description |
|---|
| 392 |
of `date'. |
|---|
| 393 |
|
|---|
| 394 |
If `date' is visible in the calendar window, the holiday STRING is on that |
|---|
| 395 |
date. If date is nil, or if the date is not visible, there is no holiday." |
|---|
| 396 |
(let ((m displayed-month) |
|---|
| 397 |
(y displayed-year)) |
|---|
| 398 |
(increment-calendar-month m y -1) |
|---|
| 399 |
(filter-visible-calendar-holidays |
|---|
| 400 |
(append |
|---|
| 401 |
(let* ((year y) |
|---|
| 402 |
(date (eval sexp)) |
|---|
| 403 |
(string (if date (eval string)))) |
|---|
| 404 |
(list (list date string))) |
|---|
| 405 |
(let* ((year (1+ y)) |
|---|
| 406 |
(date (eval sexp)) |
|---|
| 407 |
(string (if date (eval string)))) |
|---|
| 408 |
(list (list date string))))))) |
|---|
| 409 |
|
|---|
| 410 |
(defun holiday-advent (&optional n string) |
|---|
| 411 |
"Date of Nth day after advent (named STRING), if visible in calendar window. |
|---|
| 412 |
Negative values of N are interpreted as days before advent. |
|---|
| 413 |
STRING is used purely for display purposes. The return value has |
|---|
| 414 |
the form ((MONTH DAY YEAR) STRING), where the date is that of the |
|---|
| 415 |
Nth day before or after advent. |
|---|
| 416 |
|
|---|
| 417 |
For backwards compatibility, if this function is called with no |
|---|
| 418 |
arguments, then it returns the value appropriate for advent itself." |
|---|
| 419 |
|
|---|
| 420 |
(if (not n) |
|---|
| 421 |
(holiday-advent 0 "Advent") |
|---|
| 422 |
(let ((year displayed-year) |
|---|
| 423 |
(month displayed-month)) |
|---|
| 424 |
(increment-calendar-month month year -1) |
|---|
| 425 |
(let ((advent (calendar-gregorian-from-absolute |
|---|
| 426 |
(+ n |
|---|
| 427 |
(calendar-dayname-on-or-before |
|---|
| 428 |
0 |
|---|
| 429 |
(calendar-absolute-from-gregorian |
|---|
| 430 |
(list 12 3 year))))))) |
|---|
| 431 |
(if (calendar-date-is-visible-p advent) |
|---|
| 432 |
(list (list advent string))))))) |
|---|
| 433 |
|
|---|
| 434 |
(defun holiday-easter-etc (&optional n string) |
|---|
| 435 |
"Date of Nth day after Easter (named STRING), if visible in calendar window. |
|---|
| 436 |
Negative values of N are interpreted as days before Easter. |
|---|
| 437 |
STRING is used purely for display purposes. The return value has |
|---|
| 438 |
the form ((MONTH DAY YEAR) STRING), where the date is that of the |
|---|
| 439 |
Nth day before or after Easter. |
|---|
| 440 |
|
|---|
| 441 |
For backwards compatibility, if this function is called with no |
|---|
| 442 |
arguments, then it returns a list of \"standard\" Easter-related |
|---|
| 443 |
holidays (with more entries if `all-christian-calendar-holidays' |
|---|
| 444 |
is non-nil)." |
|---|
| 445 |
|
|---|
| 446 |
(if (not n) |
|---|
| 447 |
(let (res-list res) |
|---|
| 448 |
(dolist (elem (append |
|---|
| 449 |
(if all-christian-calendar-holidays |
|---|
| 450 |
'((-63 . "Septuagesima Sunday") |
|---|
| 451 |
(-56 . "Sexagesima Sunday") |
|---|
| 452 |
(-49 . "Shrove Sunday") |
|---|
| 453 |
(-48 . "Shrove Monday") |
|---|
| 454 |
(-47 . "Shrove Tuesday") |
|---|
| 455 |
(-14 . "Passion Sunday") |
|---|
| 456 |
(-7 . "Palm Sunday") |
|---|
| 457 |
(-3 . "Maundy Thursday") |
|---|
| 458 |
(35 . "Rogation Sunday") |
|---|
| 459 |
(39 . "Ascension Day") |
|---|
| 460 |
(49 . "Pentecost (Whitsunday)") |
|---|
| 461 |
(50 . "Whitmonday") |
|---|
| 462 |
(56 . "Trinity Sunday") |
|---|
| 463 |
(60 . "Corpus Christi"))) |
|---|
| 464 |
'((0 . "Easter Sunday") |
|---|
| 465 |
(-2 . "Good Friday") |
|---|
| 466 |
(-46 . "Ash Wednesday"))) |
|---|
| 467 |
res-list) |
|---|
| 468 |
|
|---|
| 469 |
(if (setq res (holiday-easter-etc (car elem) (cdr elem))) |
|---|
| 470 |
(setq res-list (append res res-list))))) |
|---|
| 471 |
(let* ((century (1+ (/ displayed-year 100))) |
|---|
| 472 |
(shifted-epact |
|---|
| 473 |
(% (+ 14 (* 11 (% displayed-year 19)) |
|---|
| 474 |
(- |
|---|
| 475 |
(/ (* 3 century) 4)) |
|---|
| 476 |
(/ |
|---|
| 477 |
(+ 5 (* 8 century)) 25) |
|---|
| 478 |
(* 30 century)) |
|---|
| 479 |
30)) |
|---|
| 480 |
(adjusted-epact |
|---|
| 481 |
(if (or (zerop shifted-epact) |
|---|
| 482 |
(and (= shifted-epact 1) (< 10 (% displayed-year 19)))) |
|---|
| 483 |
(1+ shifted-epact) |
|---|
| 484 |
shifted-epact)) |
|---|
| 485 |
(paschal-moon |
|---|
| 486 |
(- (calendar-absolute-from-gregorian (list 4 19 displayed-year)) |
|---|
| 487 |
adjusted-epact)) |
|---|
| 488 |
(abs-easter (calendar-dayname-on-or-before 0 (+ paschal-moon 7)))) |
|---|
| 489 |
(filter-visible-calendar-holidays |
|---|
| 490 |
(list (list (calendar-gregorian-from-absolute (+ abs-easter n)) |
|---|
| 491 |
string)))))) |
|---|
| 492 |
|
|---|
| 493 |
(defun holiday-greek-orthodox-easter () |
|---|
| 494 |
"Date of Easter according to the rule of the Council of Nicaea." |
|---|
| 495 |
(let ((m displayed-month) |
|---|
| 496 |
(y displayed-year)) |
|---|
| 497 |
(increment-calendar-month m y 1) |
|---|
| 498 |
(let* ((julian-year |
|---|
| 499 |
(extract-calendar-year |
|---|
| 500 |
(calendar-julian-from-absolute |
|---|
| 501 |
(calendar-absolute-from-gregorian |
|---|
| 502 |
(list m (calendar-last-day-of-month m y) y))))) |
|---|
| 503 |
(shifted-epact |
|---|
| 504 |
(% (+ 14 |
|---|
| 505 |
(* 11 (% julian-year 19))) |
|---|
| 506 |
30)) |
|---|
| 507 |
(paschal-moon |
|---|
| 508 |
(- (calendar-absolute-from-julian (list 4 19 julian-year)) |
|---|
| 509 |
shifted-epact)) |
|---|
| 510 |
(nicaean-easter |
|---|
| 511 |
(calendar-gregorian-from-absolute |
|---|
| 512 |
(calendar-dayname-on-or-before 0 (+ paschal-moon 7))))) |
|---|
| 513 |
(if (calendar-date-is-visible-p nicaean-easter) |
|---|
| 514 |
(list (list nicaean-easter "Pascha (Greek Orthodox Easter)")))))) |
|---|
| 515 |
|
|---|
| 516 |
(defun filter-visible-calendar-holidays (l) |
|---|
| 517 |
"Return a list of all visible holidays of those on L." |
|---|
| 518 |
(let ((visible) |
|---|
| 519 |
(p l)) |
|---|
| 520 |
(while p |
|---|
| 521 |
(and (car (car p)) |
|---|
| 522 |
(calendar-date-is-visible-p (car (car p))) |
|---|
| 523 |
(setq visible (append (list (car p)) visible))) |
|---|
| 524 |
(setq p (cdr p))) |
|---|
| 525 |
visible)) |
|---|
| 526 |
|
|---|
| 527 |
(provide 'holidays) |
|---|
| 528 |
|
|---|
| 529 |
|
|---|
| 530 |
|
|---|
| 531 |
|
|---|