diff options
| author | Glenn Morris | 2012-05-05 13:58:14 -0700 |
|---|---|---|
| committer | Glenn Morris | 2012-05-05 13:58:14 -0700 |
| commit | a43f98b3959cf9435de7ea5a5bb44e3fbd061085 (patch) | |
| tree | bb8f58c45b6df94d88084b10748abd18881db404 | |
| parent | fef9d1494c136356309722cbb00e7ad367233797 (diff) | |
| download | emacs-a43f98b3959cf9435de7ea5a5bb44e3fbd061085.tar.gz emacs-a43f98b3959cf9435de7ea5a5bb44e3fbd061085.zip | |
Move function from cal-tex to holidays
* calendar/holidays.el (holiday-in-range):
Move here from cal-tex-list-holidays.
* calendar/cal-tex.el (cal-tex-list-holidays):
Make it an obsolete alias for holiday-in-range. Update all callers.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/calendar/cal-tex.el | 44 | ||||
| -rw-r--r-- | lisp/calendar/holidays.el | 27 |
3 files changed, 45 insertions, 33 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 12c1e16d640..f66cd887adc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2012-05-05 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * calendar/holidays.el (holiday-in-range): | ||
| 4 | Move here from cal-tex-list-holidays. | ||
| 5 | * calendar/cal-tex.el (cal-tex-list-holidays): | ||
| 6 | Make it an obsolete alias for holiday-in-range. Update all callers. | ||
| 7 | |||
| 1 | 2012-05-05 Chong Yidong <cyd@gnu.org> | 8 | 2012-05-05 Chong Yidong <cyd@gnu.org> |
| 2 | 9 | ||
| 3 | * select.el (xselect--encode-string): Always use utf-8 for TEXT on | 10 | * select.el (xselect--encode-string): Always use utf-8 for TEXT on |
diff --git a/lisp/calendar/cal-tex.el b/lisp/calendar/cal-tex.el index 0ae2b38eaf6..2452f44448c 100644 --- a/lisp/calendar/cal-tex.el +++ b/lisp/calendar/cal-tex.el | |||
| @@ -237,31 +237,9 @@ The names are taken from `calendar-day-name-array'.") | |||
| 237 | "LaTeX code to insert one box with date info in calendar. | 237 | "LaTeX code to insert one box with date info in calendar. |
| 238 | This definition is the heart of the calendar!") | 238 | This definition is the heart of the calendar!") |
| 239 | 239 | ||
| 240 | (autoload 'calendar-holiday-list "holidays") | 240 | (autoload 'holiday-in-range "holidays") |
| 241 | 241 | ||
| 242 | (defun cal-tex-list-holidays (d1 d2) | 242 | (define-obsolete-function-alias 'cal-tex-list-holidays 'holiday-in-range "24.2") |
| 243 | "Generate a list of all holidays from absolute date D1 to D2." | ||
| 244 | (let* ((start (calendar-gregorian-from-absolute d1)) | ||
| 245 | (displayed-month (calendar-extract-month start)) | ||
| 246 | (displayed-year (calendar-extract-year start)) | ||
| 247 | (end (calendar-gregorian-from-absolute d2)) | ||
| 248 | (end-month (calendar-extract-month end)) | ||
| 249 | (end-year (calendar-extract-year end)) | ||
| 250 | (number-of-intervals | ||
| 251 | (1+ (/ (calendar-interval displayed-month displayed-year | ||
| 252 | end-month end-year) | ||
| 253 | 3))) | ||
| 254 | holidays in-range a) | ||
| 255 | (calendar-increment-month displayed-month displayed-year 1) | ||
| 256 | (dotimes (_idummy number-of-intervals) | ||
| 257 | (setq holidays (append holidays (calendar-holiday-list))) | ||
| 258 | (calendar-increment-month displayed-month displayed-year 3)) | ||
| 259 | (dolist (hol holidays) | ||
| 260 | (and (car hol) | ||
| 261 | (setq a (calendar-absolute-from-gregorian (car hol))) | ||
| 262 | (and (<= d1 a) (<= a d2)) | ||
| 263 | (setq in-range (append (list hol) in-range)))) | ||
| 264 | in-range)) | ||
| 265 | 243 | ||
| 266 | (autoload 'diary-list-entries "diary-lib") | 244 | (autoload 'diary-list-entries "diary-lib") |
| 267 | 245 | ||
| @@ -446,7 +424,7 @@ Optional EVENT indicates a buffer position to use instead of point." | |||
| 446 | (calendar-last-day-of-month end-month end-year) | 424 | (calendar-last-day-of-month end-month end-year) |
| 447 | end-year)))) | 425 | end-year)))) |
| 448 | (diary-list (if cal-tex-diary (cal-tex-list-diary-entries d1 d2))) | 426 | (diary-list (if cal-tex-diary (cal-tex-list-diary-entries d1 d2))) |
| 449 | (holidays (if cal-tex-holidays (cal-tex-list-holidays d1 d2))) | 427 | (holidays (if cal-tex-holidays (holiday-in-range d1 d2))) |
| 450 | other-month other-year small-months-at-start) | 428 | other-month other-year small-months-at-start) |
| 451 | (cal-tex-insert-preamble (cal-tex-number-weeks month year 1) t "12pt") | 429 | (cal-tex-insert-preamble (cal-tex-number-weeks month year 1) t "12pt") |
| 452 | (cal-tex-cmd cal-tex-cal-one-month) | 430 | (cal-tex-cmd cal-tex-cal-one-month) |
| @@ -516,7 +494,7 @@ indicates a buffer position to use instead of point." | |||
| 516 | (calendar-last-day-of-month end-month end-year) | 494 | (calendar-last-day-of-month end-month end-year) |
| 517 | end-year)))) | 495 | end-year)))) |
| 518 | (diary-list (if cal-tex-diary (cal-tex-list-diary-entries d1 d2))) | 496 | (diary-list (if cal-tex-diary (cal-tex-list-diary-entries d1 d2))) |
| 519 | (holidays (if cal-tex-holidays (cal-tex-list-holidays d1 d2)))) | 497 | (holidays (if cal-tex-holidays (holiday-in-range d1 d2)))) |
| 520 | (cal-tex-insert-preamble (cal-tex-number-weeks month year n) nil "12pt") | 498 | (cal-tex-insert-preamble (cal-tex-number-weeks month year n) nil "12pt") |
| 521 | (if (> n 1) | 499 | (if (> n 1) |
| 522 | (cal-tex-cmd cal-tex-cal-multi-month) | 500 | (cal-tex-cmd cal-tex-cal-multi-month) |
| @@ -697,7 +675,7 @@ entries are not shown). The calendar shows the hours 8-12am, 1-5pm." | |||
| 697 | (d1 (calendar-absolute-from-gregorian date)) | 675 | (d1 (calendar-absolute-from-gregorian date)) |
| 698 | (d2 (+ (* 7 n) d1)) | 676 | (d2 (+ (* 7 n) d1)) |
| 699 | (holidays (if cal-tex-holidays | 677 | (holidays (if cal-tex-holidays |
| 700 | (cal-tex-list-holidays d1 d2)))) | 678 | (holiday-in-range d1 d2)))) |
| 701 | (cal-tex-preamble "11pt") | 679 | (cal-tex-preamble "11pt") |
| 702 | (cal-tex-cmd "\\textwidth 6.5in") | 680 | (cal-tex-cmd "\\textwidth 6.5in") |
| 703 | (cal-tex-cmd "\\textheight 10.5in") | 681 | (cal-tex-cmd "\\textheight 10.5in") |
| @@ -752,7 +730,7 @@ Optional EVENT indicates a buffer position to use instead of point." | |||
| 752 | (d1 (calendar-absolute-from-gregorian date)) | 730 | (d1 (calendar-absolute-from-gregorian date)) |
| 753 | (d2 (+ (* 7 n) d1)) | 731 | (d2 (+ (* 7 n) d1)) |
| 754 | (holidays (if cal-tex-holidays | 732 | (holidays (if cal-tex-holidays |
| 755 | (cal-tex-list-holidays d1 d2)))) | 733 | (holiday-in-range d1 d2)))) |
| 756 | (cal-tex-preamble "12pt") | 734 | (cal-tex-preamble "12pt") |
| 757 | (cal-tex-cmd "\\textwidth 6.5in") | 735 | (cal-tex-cmd "\\textwidth 6.5in") |
| 758 | (cal-tex-cmd "\\textheight 10.5in") | 736 | (cal-tex-cmd "\\textheight 10.5in") |
| @@ -836,7 +814,7 @@ position to use instead of point." | |||
| 836 | (d1 (calendar-absolute-from-gregorian date)) | 814 | (d1 (calendar-absolute-from-gregorian date)) |
| 837 | (d2 (+ (* 7 n) d1)) | 815 | (d2 (+ (* 7 n) d1)) |
| 838 | (holidays (if cal-tex-holidays | 816 | (holidays (if cal-tex-holidays |
| 839 | (cal-tex-list-holidays d1 d2))) | 817 | (holiday-in-range d1 d2))) |
| 840 | (diary-list (if cal-tex-diary | 818 | (diary-list (if cal-tex-diary |
| 841 | (cal-tex-list-diary-entries | 819 | (cal-tex-list-diary-entries |
| 842 | ;; FIXME d1? | 820 | ;; FIXME d1? |
| @@ -1052,7 +1030,7 @@ Optional EVENT indicates a buffer position to use instead of point." | |||
| 1052 | (d1 (calendar-absolute-from-gregorian date)) | 1030 | (d1 (calendar-absolute-from-gregorian date)) |
| 1053 | (d2 (+ (* 7 n) d1)) | 1031 | (d2 (+ (* 7 n) d1)) |
| 1054 | (holidays (if cal-tex-holidays | 1032 | (holidays (if cal-tex-holidays |
| 1055 | (cal-tex-list-holidays d1 d2))) | 1033 | (holiday-in-range d1 d2))) |
| 1056 | (diary-list (if cal-tex-diary | 1034 | (diary-list (if cal-tex-diary |
| 1057 | (cal-tex-list-diary-entries | 1035 | (cal-tex-list-diary-entries |
| 1058 | ;; FIXME d1? | 1036 | ;; FIXME d1? |
| @@ -1149,7 +1127,7 @@ Optional EVENT indicates a buffer position to use instead of point." | |||
| 1149 | (d1 (calendar-absolute-from-gregorian date)) | 1127 | (d1 (calendar-absolute-from-gregorian date)) |
| 1150 | (d2 (+ (* 7 n) d1)) | 1128 | (d2 (+ (* 7 n) d1)) |
| 1151 | (holidays (if cal-tex-holidays | 1129 | (holidays (if cal-tex-holidays |
| 1152 | (cal-tex-list-holidays d1 d2))) | 1130 | (holiday-in-range d1 d2))) |
| 1153 | (diary-list (if cal-tex-diary | 1131 | (diary-list (if cal-tex-diary |
| 1154 | (cal-tex-list-diary-entries | 1132 | (cal-tex-list-diary-entries |
| 1155 | ;; FIXME d1? | 1133 | ;; FIXME d1? |
| @@ -1292,7 +1270,7 @@ Optional EVENT indicates a buffer position to use instead of point." | |||
| 1292 | (d1 (calendar-absolute-from-gregorian date)) | 1270 | (d1 (calendar-absolute-from-gregorian date)) |
| 1293 | (d2 (+ (* 7 n) d1)) | 1271 | (d2 (+ (* 7 n) d1)) |
| 1294 | (holidays (if cal-tex-holidays | 1272 | (holidays (if cal-tex-holidays |
| 1295 | (cal-tex-list-holidays d1 d2))) | 1273 | (holiday-in-range d1 d2))) |
| 1296 | (diary-list (if cal-tex-diary | 1274 | (diary-list (if cal-tex-diary |
| 1297 | (cal-tex-list-diary-entries | 1275 | (cal-tex-list-diary-entries |
| 1298 | ;; FIXME d1? | 1276 | ;; FIXME d1? |
diff --git a/lisp/calendar/holidays.el b/lisp/calendar/holidays.el index 9edd353b889..0bb3c231840 100644 --- a/lisp/calendar/holidays.el +++ b/lisp/calendar/holidays.el | |||
| @@ -645,6 +645,33 @@ strings describing those holidays that apply on DATE, or nil if none do." | |||
| 645 | (define-obsolete-function-alias | 645 | (define-obsolete-function-alias |
| 646 | 'check-calendar-holidays 'calendar-check-holidays "23.1") | 646 | 'check-calendar-holidays 'calendar-check-holidays "23.1") |
| 647 | 647 | ||
| 648 | |||
| 649 | ;; Formerly cal-tex-list-holidays. | ||
| 650 | (defun holiday-in-range (d1 d2) | ||
| 651 | "Generate a list of all holidays in range from absolute date D1 to D2." | ||
| 652 | (let* ((start (calendar-gregorian-from-absolute d1)) | ||
| 653 | (displayed-month (calendar-extract-month start)) | ||
| 654 | (displayed-year (calendar-extract-year start)) | ||
| 655 | (end (calendar-gregorian-from-absolute d2)) | ||
| 656 | (end-month (calendar-extract-month end)) | ||
| 657 | (end-year (calendar-extract-year end)) | ||
| 658 | (number-of-intervals | ||
| 659 | (1+ (/ (calendar-interval displayed-month displayed-year | ||
| 660 | end-month end-year) | ||
| 661 | 3))) | ||
| 662 | holidays in-range a) | ||
| 663 | (calendar-increment-month displayed-month displayed-year 1) | ||
| 664 | (dotimes (_idummy number-of-intervals) | ||
| 665 | (setq holidays (append holidays (calendar-holiday-list))) | ||
| 666 | (calendar-increment-month displayed-month displayed-year 3)) | ||
| 667 | (dolist (hol holidays) | ||
| 668 | (and (car hol) | ||
| 669 | (setq a (calendar-absolute-from-gregorian (car hol))) | ||
| 670 | (and (<= d1 a) (<= a d2)) | ||
| 671 | (setq in-range (append (list hol) in-range)))) | ||
| 672 | in-range)) | ||
| 673 | |||
| 674 | |||
| 648 | (declare-function x-popup-menu "menu.c" (position menu)) | 675 | (declare-function x-popup-menu "menu.c" (position menu)) |
| 649 | 676 | ||
| 650 | ;;;###cal-autoload | 677 | ;;;###cal-autoload |