comparison lisp/calendar/calendar.el @ 732:a8d94735277e

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Tue, 30 Jun 1992 13:54:21 +0000
parents 85fd29f25c75
children e694e0879463
comparison
equal deleted inserted replaced
731:5c6db33a9ef6 732:a8d94735277e
1 ;;; calendar.el --- Calendar functions. 1 ;;; calendar.el --- Calendar functions.
2 2 ;;; Copyright (C) 1988, 1989, 1990, 1991 Free Software Foundation, Inc.
3 ;; Copyright (C) 1988, 1989, 1990, 1991 Free Software Foundation, Inc.
4 3
5 ;; This file is part of GNU Emacs. 4 ;; This file is part of GNU Emacs.
6 5
7 ;; GNU Emacs is distributed in the hope that it will be useful, 6 ;; GNU Emacs is distributed in the hope that it will be useful,
8 ;; but WITHOUT ANY WARRANTY. No author or distributor 7 ;; but WITHOUT ANY WARRANTY. No author or distributor
65 ;; Technical details of all the calendrical calculations can be found in 64 ;; Technical details of all the calendrical calculations can be found in
66 ;; ``Calendrical Calculations'' by Nachum Dershowitz and Edward M. Reingold, 65 ;; ``Calendrical Calculations'' by Nachum Dershowitz and Edward M. Reingold,
67 ;; Software--Practice and Experience, Volume 20, Number 9 (September, 1990), 66 ;; Software--Practice and Experience, Volume 20, Number 9 (September, 1990),
68 ;; pages 899-928. 67 ;; pages 899-928.
69 68
70 (defconst calendar-version "Version 4.01, released August 20, 1991") 69 (defconst calendar-version "Version 4.02, released June 14, 1992")
71 70
72 (defvar view-diary-entries-initially nil 71 (defvar view-diary-entries-initially nil
73 "*If T, the diary entries for the current date will be displayed on entry. 72 "*If T, the diary entries for the current date will be displayed on entry.
74 The diary is displayed in another window when the calendar is first displayed, 73 The diary is displayed in another window when the calendar is first displayed,
75 if the current date is visible. The number of days of diary entries displayed 74 if the current date is visible. The number of days of diary entries displayed
100 (defvar view-calendar-holidays-initially nil 99 (defvar view-calendar-holidays-initially nil
101 "*If t, the holidays for the current three month period will be displayed 100 "*If t, the holidays for the current three month period will be displayed
102 on entry. The holidays are displayed in another window when the calendar is 101 on entry. The holidays are displayed in another window when the calendar is
103 first displayed.") 102 first displayed.")
104 103
104 ;;;###autoload
105 (defvar mark-holidays-in-calendar nil 105 (defvar mark-holidays-in-calendar nil
106 "*If t, dates of holidays will be marked in the calendar window. 106 "*If t, dates of holidays will be marked in the calendar window.
107 The marking symbol is specified by the variable `calendar-holiday-marker'.") 107 The marking symbol is specified by the variable `calendar-holiday-marker'.")
108 108
109 (defvar calendar-holiday-marker "*" 109 (defvar calendar-holiday-marker "*"
110 "*The symbol used to mark notable dates in the calendar.") 110 "*The symbol used to mark notable dates in the calendar.")
111 111
112 ;;;###autoload
112 (defvar all-hebrew-calendar-holidays nil 113 (defvar all-hebrew-calendar-holidays nil
113 "*If nil, the holidays from the Hebrew calendar that are shown will 114 "*If nil, the holidays from the Hebrew calendar that are shown will
114 include only those days of such major interest as to appear on secular 115 include only those days of such major interest as to appear on secular
115 calendars. If t, the holidays shown in the calendar will include all 116 calendars. If t, the holidays shown in the calendar will include all
116 special days that would be shown on a complete Hebrew calendar.") 117 special days that would be shown on a complete Hebrew calendar.")
117 118
119 ;;;###autoload
118 (defvar all-christian-calendar-holidays nil 120 (defvar all-christian-calendar-holidays nil
119 "*If nil, the holidays from the Christian calendar that are shown will 121 "*If nil, the holidays from the Christian calendar that are shown will
120 include only those days of such major interest as to appear on secular 122 include only those days of such major interest as to appear on secular
121 calendars. If t, the holidays shown in the calendar will include all 123 calendars. If t, the holidays shown in the calendar will include all
122 special days that would be shown on a complete Christian calendar.") 124 special days that would be shown on a complete Christian calendar.")
123 125
126 ;;;###autoload
124 (defvar all-islamic-calendar-holidays nil 127 (defvar all-islamic-calendar-holidays nil
125 "*If nil, the holidays from the Islamic calendar that are shown will 128 "*If nil, the holidays from the Islamic calendar that are shown will
126 include only those days of such major interest as to appear on secular 129 include only those days of such major interest as to appear on secular
127 calendars. If t, the holidays shown in the calendar will include all 130 calendars. If t, the holidays shown in the calendar will include all
128 special days that would be shown on a complete Islamic calendar.") 131 special days that would be shown on a complete Islamic calendar.")
399 diary buffer), does the printing, and kills the buffer. Other uses might 402 diary buffer), does the printing, and kills the buffer. Other uses might
400 include, for example, rearranging the lines into order by day and time, 403 include, for example, rearranging the lines into order by day and time,
401 saving the buffer instead of deleting it, or changing the function used to 404 saving the buffer instead of deleting it, or changing the function used to
402 do the printing.") 405 do the printing.")
403 406
407 ;;;###autoload
404 (defvar list-diary-entries-hook nil 408 (defvar list-diary-entries-hook nil
405 "*List of functions to be called after the diary file is culled for 409 "*List of functions to be called after the diary file is culled for
406 relevant entries. It is to be used for diary entries that are not found in 410 relevant entries. It is to be used for diary entries that are not found in
407 the diary file. 411 the diary file.
408 412
430 434
431 in your .emacs file to cause the fancy diary buffer to be displayed with 435 in your .emacs file to cause the fancy diary buffer to be displayed with
432 diary entries from various included files, each day's entries sorted into 436 diary entries from various included files, each day's entries sorted into
433 lexicographic order.") 437 lexicographic order.")
434 438
439 ;;;###autoload
435 (defvar diary-display-hook 'simple-diary-display 440 (defvar diary-display-hook 'simple-diary-display
436 "*List of functions that handle the display of the diary. 441 "*List of functions that handle the display of the diary.
437 442
438 Ordinarily, this just displays the diary buffer (with holidays indicated in 443 Ordinarily, this just displays the diary buffer (with holidays indicated in
439 the mode line), if there are any relevant entries. At the time these 444 the mode line), if there are any relevant entries. At the time these
451 variable `holidays-in-diary-buffer' is set to nil. Ordinarily, the fancy 456 variable `holidays-in-diary-buffer' is set to nil. Ordinarily, the fancy
452 diary buffer will not show days for which there are no diary entries, even 457 diary buffer will not show days for which there are no diary entries, even
453 if that day is a holiday; if you want such days to be shown in the fancy 458 if that day is a holiday; if you want such days to be shown in the fancy
454 diary buffer, set the variable `diary-list-include-blanks' to t.") 459 diary buffer, set the variable `diary-list-include-blanks' to t.")
455 460
461 ;;;###autoload
456 (defvar nongregorian-diary-listing-hook nil 462 (defvar nongregorian-diary-listing-hook nil
457 "*List of functions to be called for the diary file and included files as 463 "*List of functions to be called for the diary file and included files as
458 they are processed for listing diary entries. You can use any or all of 464 they are processed for listing diary entries. You can use any or all of
459 `list-hebrew-diary-entries', `yahrzeit-diary-entry', and 465 `list-hebrew-diary-entries', `yahrzeit-diary-entry', and
460 `list-islamic-diary-entries'. The documentation for these functions 466 `list-islamic-diary-entries'. The documentation for these functions
472 obeyed. You can change the \"#include\" to some other string by changing the 478 obeyed. You can change the \"#include\" to some other string by changing the
473 variable `diary-include-string'. When you use `mark-included-diary-files' as 479 variable `diary-include-string'. When you use `mark-included-diary-files' as
474 part of the mark-diary-entries-hook, you will probably also want to use the 480 part of the mark-diary-entries-hook, you will probably also want to use the
475 function `include-other-diary-files' as part of the list-diary-entries-hook.") 481 function `include-other-diary-files' as part of the list-diary-entries-hook.")
476 482
483 ;;;###autoload
477 (defvar nongregorian-diary-marking-hook nil 484 (defvar nongregorian-diary-marking-hook nil
478 "*List of functions to be called as the diary file and included files are 485 "*List of functions to be called as the diary file and included files are
479 processed for marking diary entries. You can use either or both of 486 processed for marking diary entries. You can use either or both of
480 mark-hebrew-diary-entries and mark-islamic-diary-entries. The documentation 487 mark-hebrew-diary-entries and mark-islamic-diary-entries. The documentation
481 for these functions describes the style of such diary entries.") 488 for these functions describes the style of such diary entries.")
482 489
490 ;;;###autoload
483 (defvar diary-list-include-blanks nil 491 (defvar diary-list-include-blanks nil
484 "*If nil, do not include days with no diary entry in the list of diary 492 "*If nil, do not include days with no diary entry in the list of diary
485 entries. Such days will then not be shown in the the fancy diary buffer, 493 entries. Such days will then not be shown in the the fancy diary buffer,
486 even if they are holidays.") 494 even if they are holidays.")
487 495
691 the inclusion of the functions `calendar-holiday-function-fixed', 699 the inclusion of the functions `calendar-holiday-function-fixed',
692 `calendar-holiday-function-float', `calendar-holiday-function-hebrew', 700 `calendar-holiday-function-float', `calendar-holiday-function-hebrew',
693 `calendar-holiday-function-islamic', `calendar-holiday-function-julian', 701 `calendar-holiday-function-islamic', `calendar-holiday-function-julian',
694 and `calendar-holiday-function-if', respectively.") 702 and `calendar-holiday-function-if', respectively.")
695 703
696
697 (defconst calendar-buffer "*Calendar*" 704 (defconst calendar-buffer "*Calendar*"
698 "Name of the buffer used for the calendar.") 705 "Name of the buffer used for the calendar.")
699 706
700 (defconst holiday-buffer "*Holidays*" 707 (defconst holiday-buffer "*Holidays*"
701 "Name of the buffer used for the displaying the holidays.") 708 "Name of the buffer used for the displaying the holidays.")
724 (while (, condition) 731 (while (, condition)
725 (setq sum (+ sum (, expression) )) 732 (setq sum (+ sum (, expression) ))
726 (setq (, index) (1+ (, index)))) 733 (setq (, index) (1+ (, index))))
727 sum))) 734 sum)))
728 735
736 ;; The following macros are for speed; the code would be clearer if they
737 ;; were functions, but they can be called thousands of times when
738 ;; looking up holidays or processing the diary. Here, for example, are the
739 ;; numbers of calls to calendar/diary/holiday functions in preparing the
740 ;; fancy diary display, for a moderately complex diary file, with functions
741 ;; used instead of macros. There were a total of 10000 such calls:
742 ;;
743 ;; 1934 extract-calendar-month
744 ;; 1852 extract-calendar-year
745 ;; 1819 extract-calendar-day
746 ;; 845 calendar-leap-year-p
747 ;; 837 calendar-day-number
748 ;; 775 calendar-absolute-from-gregorian
749 ;; 346 calendar-last-day-of-month
750 ;; 286 hebrew-calendar-last-day-of-month
751 ;; 188 hebrew-calendar-leap-year-p
752 ;; 180 hebrew-calendar-elapsed-days
753 ;; 163 hebrew-calendar-last-month-of-year
754 ;; 66 calendar-date-compare
755 ;; 65 hebrew-calendar-days-in-year
756 ;; 60 calendar-absolute-from-julian
757 ;; 50 calendar-absolute-from-hebrew
758 ;; 43 calendar-date-equal
759 ;; 38 calendar-gregorian-from-absolute
760 ;; .
761 ;; .
762 ;; .
763 ;;
764 ;; The use of these seven macros eliminates the overhead of 92% of the function
765 ;; calls; it's faster this way.
766
729 (defmacro extract-calendar-month (date) 767 (defmacro extract-calendar-month (date)
730 "Extract the month part of DATE which has the form (month day year)." 768 "Extract the month part of DATE which has the form (month day year)."
731 (` (car (, date)))) 769 (` (car (, date))))
732 770
733 (defmacro extract-calendar-day (date) 771 (defmacro extract-calendar-day (date)
735 (` (car (cdr (, date))))) 773 (` (car (cdr (, date)))))
736 774
737 (defmacro extract-calendar-year (date) 775 (defmacro extract-calendar-year (date)
738 "Extract the year part of DATE which has the form (month day year)." 776 "Extract the year part of DATE which has the form (month day year)."
739 (` (car (cdr (cdr (, date)))))) 777 (` (car (cdr (cdr (, date))))))
778
779 (defmacro calendar-leap-year-p (year)
780 "Returns t if YEAR is a Gregorian leap year."
781 (` (or
782 (and (= (% (, year) 4) 0)
783 (/= (% (, year) 100) 0))
784 (= (% (, year) 400) 0))))
785
786 (defmacro calendar-last-day-of-month (month year)
787 "The last day in MONTH during YEAR."
788 (` (if (and
789 (, (macroexpand (` (calendar-leap-year-p (, year)))))
790 (= (, month) 2))
791 29
792 (aref [31 28 31 30 31 30 31 31 30 31 30 31] (1- (, month))))))
793
794 (defmacro calendar-day-number (date)
795 "Return the day number within the year of the date DATE.
796 For example, (calendar-day-number '(1 1 1987)) returns the value 1,
797 while (calendar-day-number '(12 31 1980)) returns 366."
798 ;;
799 ;; An explanation of the calculation can be found in PascAlgorithms by
800 ;; Edward and Ruth Reingold, Scott-Foresman/Little, Brown, 1988.
801 ;;
802 (` (let* ((month (, (macroexpand (` (extract-calendar-month (, date))))))
803 (day (, (macroexpand (` (extract-calendar-day (, date))))))
804 (year (, (macroexpand (` (extract-calendar-year (, date))))))
805 (day-of-year (+ day (* 31 (1- month)))))
806 (if (> month 2)
807 (progn
808 (setq day-of-year (- day-of-year (/ (+ 23 (* 4 month)) 10)))
809 (if (, (macroexpand (` (calendar-leap-year-p year))))
810 (setq day-of-year (1+ day-of-year)))))
811 day-of-year)))
812
813 (defmacro calendar-absolute-from-gregorian (date)
814 "The number of days elapsed between the Gregorian date 12/31/1 BC and DATE.
815 The Gregorian date Sunday, December 31, 1 BC is imaginary."
816 (` (let ((month (, (macroexpand (` (extract-calendar-month (, date))))))
817 (day (, (macroexpand (` (extract-calendar-day (, date))))))
818 (year (, (macroexpand (` (extract-calendar-year (, date)))))))
819 (+ (, (macroexpand (` (calendar-day-number (, date)))));; Days this year
820 (* 365 (1- year));; + Days in prior years
821 (/ (1- year) 4);; + Julian leap years
822 (- (/ (1- year) 100));; - century years
823 (/ (1- year) 400)))));; + Gregorian leap years
740 824
741 ;;;###autoload 825 ;;;###autoload
742 (defun calendar (&optional arg) 826 (defun calendar (&optional arg)
743 "Display a three-month calendar in another window. 827 "Display a three-month calendar in another window.
744 The three months appear side by side, with the current month in the middle 828 The three months appear side by side, with the current month in the middle
942 is currently located, but indented INDENT spaces. The indentation is done 1026 is currently located, but indented INDENT spaces. The indentation is done
943 from the first character on the line and does not disturb the first INDENT 1027 from the first character on the line and does not disturb the first INDENT
944 characters on the line." 1028 characters on the line."
945 (let* ((first-day-of-month (calendar-day-of-week (list month 1 year))) 1029 (let* ((first-day-of-month (calendar-day-of-week (list month 1 year)))
946 (first-saturday (- 7 first-day-of-month)) 1030 (first-saturday (- 7 first-day-of-month))
947 (last (calendar-last-day-of-month month year))) 1031 (last (calendar-last-day-of-month month year))
1032 (heading (format "%s %d" (calendar-month-name month) year)))
948 (goto-char (point-min)) 1033 (goto-char (point-min))
949 (calendar-insert-indented 1034 (calendar-insert-indented
950 (format " %s %d" (calendar-month-name month) year) indent t) 1035 heading (+ indent (/ (- 20 (length heading)) 2)) t)
951 (calendar-insert-indented " S M Tu W Th F S" indent t) 1036 (calendar-insert-indented " S M Tu W Th F S" indent t)
952 (calendar-insert-indented "" indent);; Move to appropriate spot on line 1037 (calendar-insert-indented "" indent);; Move to appropriate spot on line
953 ;; Add blank days before the first of the month 1038 ;; Add blank days before the first of the month
954 (calendar-for-loop i from 1 to first-day-of-month do 1039 (calendar-for-loop i from 1 to first-day-of-month do
955 (insert " ")) 1040 (insert " "))
1900 (defun calendar-interval (mon1 yr1 mon2 yr2) 1985 (defun calendar-interval (mon1 yr1 mon2 yr2)
1901 "The number of months difference between the two specified months." 1986 "The number of months difference between the two specified months."
1902 (+ (* 12 (- yr2 yr1)) 1987 (+ (* 12 (- yr2 yr1))
1903 (- mon2 mon1))) 1988 (- mon2 mon1)))
1904 1989
1905 (defun calendar-leap-year-p (year)
1906 "Returns t if YEAR is a Gregorian leap year."
1907 (or
1908 (and (= (% year 4) 0)
1909 (/= (% year 100) 0))
1910 (= (% year 400) 0)))
1911
1912 (defun calendar-day-number (date)
1913 "Return the day number within the year of the date DATE.
1914 For example, (calendar-day-number '(1 1 1987)) returns the value 1,
1915 while (calendar-day-number '(12 31 1980)) returns 366."
1916 ;;
1917 ;; An explanation of the calculation can be found in PascAlgorithms by
1918 ;; Edward and Ruth Reingold, Scott-Foresman/Little, Brown, 1988.
1919 ;;
1920 (let* ((month (extract-calendar-month date))
1921 (day (extract-calendar-day date))
1922 (year (extract-calendar-year date))
1923 (day-of-year (+ day (* 31 (1- month)))))
1924 (if (> month 2)
1925 (progn
1926 (setq day-of-year (- day-of-year (/ (+ 23 (* 4 month)) 10)))
1927 (if (calendar-leap-year-p year)
1928 (setq day-of-year (1+ day-of-year)))))
1929 day-of-year))
1930
1931 (defun calendar-day-name (date) 1990 (defun calendar-day-name (date)
1932 "Returns a string with the name of the day of the week of DATE." 1991 "Returns a string with the name of the day of the week of DATE."
1933 (aref calendar-day-name-array (calendar-day-of-week date))) 1992 (aref calendar-day-name-array (calendar-day-of-week date)))
1934 1993
1935 (defconst calendar-day-name-array 1994 (defconst calendar-day-name-array
1936 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday"]) 1995 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday"])
1937
1938 (defun calendar-last-day-of-month (month year)
1939 "The last day in MONTH during YEAR."
1940 (if (and (calendar-leap-year-p year) (= month 2))
1941 29
1942 (aref [31 28 31 30 31 30 31 31 30 31 30 31] (1- month))))
1943 1996
1944 (defconst calendar-month-name-array 1997 (defconst calendar-month-name-array
1945 ["January" "February" "March" "April" "May" "June" 1998 ["January" "February" "March" "April" "May" "June"
1946 "July" "August" "September" "October" "November" "December"]) 1999 "July" "August" "September" "October" "November" "December"])
1947 2000
1962 (aref calendar-month-name-array (1- month))) 2015 (aref calendar-month-name-array (1- month)))
1963 2016
1964 (defun calendar-day-of-week (date) 2017 (defun calendar-day-of-week (date)
1965 "Returns the day-of-the-week index of DATE, 0 for Sunday, 1 for Monday, etc." 2018 "Returns the day-of-the-week index of DATE, 0 for Sunday, 1 for Monday, etc."
1966 (% (calendar-absolute-from-gregorian date) 7)) 2019 (% (calendar-absolute-from-gregorian date) 7))
1967
1968 (defun calendar-absolute-from-gregorian (date)
1969 "The number of days elapsed between the Gregorian date 12/31/1 BC and DATE.
1970 The Gregorian date Sunday, December 31, 1 BC is imaginary."
1971 (let ((month (extract-calendar-month date))
1972 (day (extract-calendar-day date))
1973 (year (extract-calendar-year date)))
1974 (+ (calendar-day-number date);; Days this year
1975 (* 365 (1- year));; + Days in prior years
1976 (/ (1- year) 4);; + Julian leap years
1977 (- (/ (1- year) 100));; - century years
1978 (/ (1- year) 400))));; + Gregorian leap years
1979 2020
1980 (defun calendar-unmark () 2021 (defun calendar-unmark ()
1981 "Delete the diary and holiday marks from the calendar." 2022 "Delete the diary and holiday marks from the calendar."
1982 (interactive) 2023 (interactive)
1983 (setq mark-diary-entries-in-calendar nil) 2024 (setq mark-diary-entries-in-calendar nil)
2457 (if (hebrew-calendar-leap-year-p (extract-calendar-year hebrew-date)) 2498 (if (hebrew-calendar-leap-year-p (extract-calendar-year hebrew-date))
2458 calendar-hebrew-month-name-array-leap-year 2499 calendar-hebrew-month-name-array-leap-year
2459 calendar-hebrew-month-name-array-common-year))) 2500 calendar-hebrew-month-name-array-common-year)))
2460 (message "Hebrew date: %s" (calendar-date-string hebrew-date nil t)))) 2501 (message "Hebrew date: %s" (calendar-date-string hebrew-date nil t))))
2461 2502
2503 (defun hebrew-calendar-yahrzeit (death-date year)
2504 "Absolute date of the anniversary of Hebrew DEATH-DATE in Hebrew YEAR."
2505 (let* ((death-day (extract-calendar-day death-date))
2506 (death-month (extract-calendar-month death-date))
2507 (death-year (extract-calendar-year death-date)))
2508 (cond
2509 ;; If it's Heshvan 30 it depends on the first anniversary; if
2510 ;; that was not Heshvan 30, use the day before Kislev 1.
2511 ((and (= death-month 8)
2512 (= death-day 30)
2513 (not (hebrew-calendar-long-heshvan-p (1+ death-year))))
2514 (1- (calendar-absolute-from-hebrew (list 9 1 year))))
2515 ;; If it's Kislev 30 it depends on the first anniversary; if
2516 ;; that was not Kislev 30, use the day before Teveth 1.
2517 ((and (= death-month 9)
2518 (= death-day 30)
2519 (hebrew-calendar-short-kislev-p (1+ death-year)))
2520 (1- (calendar-absolute-from-hebrew (list 10 1 year))))
2521 ;; If it's Adar II, use the same day in last month of
2522 ;; year (Adar or Adar II).
2523 ((= death-month 13)
2524 (calendar-absolute-from-hebrew
2525 (list (last-month-of-hebrew-year year) death-day year)))
2526 ;; If it's the 30th in Adar I and $year$ is not a leap year
2527 ;; (so Adar has only 29 days), use the last day in Shevat.
2528 ((and (= death-day 30)
2529 (= death-month 12)
2530 (not (hebrew-calendar-leap-year-p death-year)))
2531 (calendar-absolute-from-hebrew (list 11 30 year)))
2532 ;; In all other cases, use the normal anniversary of the date of death.
2533 (t (calendar-absolute-from-hebrew
2534 (list death-month death-day year))))))
2535
2536 (defun list-yahrzeit-dates (death-date start-year end-year)
2537 "List of Yahrzeit dates for *Gregorian* DEATH-DATE
2538 from START-YEAR to END-YEAR. When called interactively
2539 the date of death is taken from the cursor in the calendar window."
2540 (interactive
2541 (let* ((death-date (calendar-cursor-to-date))
2542 (death-year (extract-calendar-year death-date))
2543 (start-year (calendar-read
2544 (format "Starting year of Yahrzeit table (>%d): "
2545 death-year)
2546 '(lambda (x) (> x death-year))
2547 (int-to-string (1+ death-year))))
2548 (end-year (calendar-read
2549 (format "Ending year of Yahrzeit table (>=%d): "
2550 start-year)
2551 '(lambda (x) (>= x start-year)))))
2552 (list death-date start-year end-year)))
2553 (message "Computing yahrzeits...")
2554 (let* ((yahrzeit-buffer "*Yahrzeits*")
2555 (h-date (calendar-hebrew-from-absolute
2556 (calendar-absolute-from-gregorian death-date)))
2557 (h-month (extract-calendar-month h-date))
2558 (h-day (extract-calendar-day h-date))
2559 (h-year (extract-calendar-year h-date)))
2560 (set-buffer (get-buffer-create yahrzeit-buffer))
2561 (setq buffer-read-only nil)
2562 (setq mode-line-format
2563 (format "------Yahrzeit dates for %s = %s%%-"
2564 (calendar-date-string death-date)
2565 (let ((calendar-month-name-array
2566 (if (hebrew-calendar-leap-year-p h-year)
2567 calendar-hebrew-month-name-array-leap-year
2568 calendar-hebrew-month-name-array-common-year))
2569 (calendar-date-display-form
2570 (if european-calendar-style
2571 '(day " " monthname " " year)
2572 '(monthname " " day ", " year))))
2573 (calendar-date-string h-date nil t))))
2574 (erase-buffer)
2575 (goto-char (point-min))
2576 (calendar-for-loop i from start-year to end-year do
2577 (insert
2578 (calendar-date-string
2579 (calendar-gregorian-from-absolute
2580 (hebrew-calendar-yahrzeit
2581 h-date
2582 (extract-calendar-year
2583 (calendar-hebrew-from-absolute
2584 (calendar-absolute-from-gregorian (list 1 1 i))))))) "\n"))
2585 (goto-char (point-min))
2586 (set-buffer-modified-p nil)
2587 (setq buffer-read-only t)
2588 (display-buffer yahrzeit-buffer)
2589 (message "Computing yahrzeits...done")))
2590
2462 (defun french-calendar-leap-year-p (year) 2591 (defun french-calendar-leap-year-p (year)
2463 "True if YEAR is a leap year on the French Revolutionary calendar. 2592 "True if YEAR is a leap year on the French Revolutionary calendar.
2464 For Gregorian years 1793 to 1805, the years of actual operation of the 2593 For Gregorian years 1793 to 1805, the years of actual operation of the
2465 calendar, uses historical practice based on equinoxes is followed (years 3, 7, 2594 calendar, uses historical practice based on equinoxes is followed (years 3, 7,
2466 and 11 were leap years; 15 and 20 would have been leap years). For later 2595 and 11 were leap years; 15 and 20 would have been leap years). For later