aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2008-04-03 04:10:43 +0000
committerGlenn Morris2008-04-03 04:10:43 +0000
commit1dbf6332835000a130fb12bcfe808e4b3461c688 (patch)
tree88da28460ce47a969f31e7385da9787b39793222
parentc094b3f9c3ebcfc82915576a4605e52df07db77c (diff)
downloademacs-1dbf6332835000a130fb12bcfe808e4b3461c688.tar.gz
emacs-1dbf6332835000a130fb12bcfe808e4b3461c688.zip
(calendar-holiday-list): Fix previous change.
(holiday-filter-visible-calendar): Doc fix. Use mapcar. (holiday-easter-etc): Fix nesting of result. Tweak holiday order. Use calendar-date-is-visible-p, not holiday-filter-visible-calendar.
-rw-r--r--lisp/ChangeLog25
-rw-r--r--lisp/calendar/holidays.el92
2 files changed, 71 insertions, 46 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1eef62591bd..deba0289721 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -35,8 +35,33 @@
35 Remove declarations; no longer used. 35 Remove declarations; no longer used.
36 (c-cpp-define-name, c-defun-name): Declare as functions. 36 (c-cpp-define-name, c-defun-name): Declare as functions.
37 37
38 * calendar/cal-bahai.el (holiday-fixed): Autoload it.
39 (holiday-bahai-new-year, holiday-bahai-ridvan): New functions.
40
41 * calendar/cal-hebrew.el (holiday-rosh-hashanah-etc)
42 (holiday-passover-etc, holiday-hanukkah): Doc fix. Add optional
43 argument. Simplify.
44 (holiday-tisha-b-av-etc): Use memq rather than unless.
45 (holiday-julian): Autoload it.
46 (holiday-hebrew-misc): New function.
47
48 * calendar/cal-islam.el (holiday-islamic-new-year): New function.
49
50 * calendar/calendar.el (hebrew-holidays-1, hebrew-holidays-2)
51 (hebrew-holidays-3, hebrew-holidays-4): Make obsolete.
52 (hebrew-holidays-2): Just use holiday-hanukkah now it respects
53 all-hebrew-calendar-holidays.
54 (hebrew-holidays, christian-holidays, islamic-holidays, bahai-holidays):
55 Simplify using new functions.
56 (generate-calendar-window): Use bound-and-true-p.
57
38 * calendar/diary-lib.el (diary-mail-addr): Use bound-and-true-p. 58 * calendar/diary-lib.el (diary-mail-addr): Use bound-and-true-p.
39 59
60 * calendar/holidays.el (calendar-holiday-list): Fix previous change.
61 (holiday-filter-visible-calendar): Doc fix. Use mapcar.
62 (holiday-easter-etc): Fix nesting of result. Tweak holiday order.
63 Use calendar-date-is-visible-p, not holiday-filter-visible-calendar.
64
40 * net/tramp.el (tramp-drop-volume-letter): Move definition before use. 65 * net/tramp.el (tramp-drop-volume-letter): Move definition before use.
41 66
422008-04-03 Stefan Monnier <monnier@iro.umontreal.ca> 672008-04-03 Stefan Monnier <monnier@iro.umontreal.ca>
diff --git a/lisp/calendar/holidays.el b/lisp/calendar/holidays.el
index 8404f604abc..f81f2012fcf 100644
--- a/lisp/calendar/holidays.el
+++ b/lisp/calendar/holidays.el
@@ -39,19 +39,19 @@
39(defun calendar-holiday-list () 39(defun calendar-holiday-list ()
40 "Form the list of holidays that occur on dates in the calendar window. 40 "Form the list of holidays that occur on dates in the calendar window.
41The holidays are those in the list `calendar-holidays'." 41The holidays are those in the list `calendar-holidays'."
42 (sort (delq nil 42 (let (res h)
43 (mapcar (lambda (p) 43 (sort
44 (car 44 (dolist (p calendar-holidays res)
45 (if calendar-debug-sexp 45 (if (setq h (if calendar-debug-sexp
46 (let ((stack-trace-on-error t)) 46 (let ((stack-trace-on-error t))
47 (eval p)) 47 (eval p))
48 (condition-case nil 48 (condition-case nil
49 (eval p) 49 (eval p)
50 (error (beep) 50 (error (beep)
51 (message "Bad holiday list item: %s" p) 51 (message "Bad holiday list item: %s" p)
52 (sleep-for 2)))))) 52 (sleep-for 2)))))
53 calendar-holidays)) 53 (setq res (append h res))))
54 'calendar-date-compare)) 54 'calendar-date-compare)))
55 55
56(defvar displayed-month) ; from generate-calendar 56(defvar displayed-month) ; from generate-calendar
57(defvar displayed-year) 57(defvar displayed-year)
@@ -322,13 +322,12 @@ Returns nil if it is not visible in the current calendar window."
322 (list (list (calendar-nth-named-day n dayname month y d) 322 (list (list (calendar-nth-named-day n dayname month y d)
323 string))))) 323 string)))))
324 324
325(defun holiday-filter-visible-calendar (l) 325(defun holiday-filter-visible-calendar (hlist)
326 "Return a list of all visible holidays of those on L." 326 "Filter list of holidays HLIST, and return only the visible ones.
327 (let (visible) 327HLIST is a list of elements of the form (DATE) TEXT."
328 (dolist (p l visible) 328 (delq nil (mapcar (lambda (p)
329 (and (car p) 329 (and (car p) (calendar-date-is-visible-p (car p)) p))
330 (calendar-date-is-visible-p (car p)) 330 hlist)))
331 (push p visible)))))
332 331
333(define-obsolete-function-alias 332(define-obsolete-function-alias
334 'filter-visible-calendar-holidays 'holiday-filter-visible-calendar "23.1") 333 'filter-visible-calendar-holidays 'holiday-filter-visible-calendar "23.1")
@@ -394,28 +393,29 @@ holidays (with more entries if `all-christian-calendar-holidays'
394is non-nil)." 393is non-nil)."
395 ;; Backwards compatibility layer. 394 ;; Backwards compatibility layer.
396 (if (not n) 395 (if (not n)
397 (delq nil ; filter out nil (not visible) dates 396 (apply 'append
398 (mapcar (lambda (e) 397 (mapcar (lambda (e)
399 (apply 'holiday-easter-etc e)) 398 (apply 'holiday-easter-etc e))
400 (append 399 ;; The combined list is not in order.
401 (if all-christian-calendar-holidays 400 (append
402 '((-63 "Septuagesima Sunday") 401 (if all-christian-calendar-holidays
403 (-56 "Sexagesima Sunday") 402 '((-63 "Septuagesima Sunday")
404 (-49 "Shrove Sunday") 403 (-56 "Sexagesima Sunday")
405 (-48 "Shrove Monday") 404 (-49 "Shrove Sunday")
406 (-47 "Shrove Tuesday") 405 (-48 "Shrove Monday")
407 (-14 "Passion Sunday") 406 (-47 "Shrove Tuesday")
408 (-7 "Palm Sunday") 407 (-14 "Passion Sunday")
409 (-3 "Maundy Thursday") 408 (-7 "Palm Sunday")
410 (35 "Rogation Sunday") 409 (-3 "Maundy Thursday")
411 (39 "Ascension Day") 410 (35 "Rogation Sunday")
412 (49 "Pentecost (Whitsunday)") 411 (39 "Ascension Day")
413 (50 "Whitmonday") 412 (49 "Pentecost (Whitsunday)")
414 (56 "Trinity Sunday") 413 (50 "Whitmonday")
415 (60 "Corpus Christi"))) 414 (56 "Trinity Sunday")
416 '((0 "Easter Sunday") 415 (60 "Corpus Christi")))
417 (-2 "Good Friday") 416 '((-46 "Ash Wednesday")
418 (-46 "Ash Wednesday"))))) 417 (-2 "Good Friday")
418 (0 "Easter Sunday")))))
419 (let* ((century (1+ (/ displayed-year 100))) 419 (let* ((century (1+ (/ displayed-year 100)))
420 (shifted-epact ; age of moon for April 5... 420 (shifted-epact ; age of moon for April 5...
421 (% (+ 14 (* 11 (% displayed-year 19)) ; ...by Nicaean rule 421 (% (+ 14 (* 11 (% displayed-year 19)) ; ...by Nicaean rule
@@ -433,10 +433,10 @@ is non-nil)."
433 (paschal-moon ; day after the full moon on or after March 21 433 (paschal-moon ; day after the full moon on or after March 21
434 (- (calendar-absolute-from-gregorian (list 4 19 displayed-year)) 434 (- (calendar-absolute-from-gregorian (list 4 19 displayed-year))
435 adjusted-epact)) 435 adjusted-epact))
436 (abs-easter (calendar-dayname-on-or-before 0 (+ paschal-moon 7)))) 436 (abs-easter (calendar-dayname-on-or-before 0 (+ paschal-moon 7)))
437 (holiday-filter-visible-calendar 437 (greg (calendar-gregorian-from-absolute (+ abs-easter n))))
438 (list (list (calendar-gregorian-from-absolute (+ abs-easter n)) 438 (if (calendar-date-is-visible-p greg)
439 string)))))) 439 (list (list greg string))))))
440 440
441;; Prior call to calendar-julian-from-absolute will autoload cal-julian. 441;; Prior call to calendar-julian-from-absolute will autoload cal-julian.
442(declare-function calendar-absolute-from-julian "cal-julian" (date)) 442(declare-function calendar-absolute-from-julian "cal-julian" (date))