aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2008-04-01 02:54:50 +0000
committerGlenn Morris2008-04-01 02:54:50 +0000
commit589117b4df8fd6f6bf81fd840bab0a3374437fb0 (patch)
tree5f57efe58b51291f8dcebdabd63542936e90f749
parent2f264ff695541003296f9a0f6fe94f72228a58f2 (diff)
downloademacs-589117b4df8fd6f6bf81fd840bab0a3374437fb0.tar.gz
emacs-589117b4df8fd6f6bf81fd840bab0a3374437fb0.zip
(holiday-julian): Use calendar-nongregorian-visible-p.
-rw-r--r--lisp/calendar/cal-julian.el47
1 files changed, 9 insertions, 38 deletions
diff --git a/lisp/calendar/cal-julian.el b/lisp/calendar/cal-julian.el
index 791e78e4811..94b7d698e70 100644
--- a/lisp/calendar/cal-julian.el
+++ b/lisp/calendar/cal-julian.el
@@ -128,50 +128,21 @@ Driven by the variable `calendar-date-display-form'."
128 (calendar-absolute-from-julian date))) 128 (calendar-absolute-from-julian date)))
129 (or noecho (calendar-print-julian-date))) 129 (or noecho (calendar-print-julian-date)))
130 130
131(defvar displayed-month)
132(defvar displayed-year)
133
134;;;###holiday-autoload 131;;;###holiday-autoload
135(defun holiday-julian (month day string) 132(defun holiday-julian (month day string)
136 "Holiday on MONTH, DAY (Julian) called STRING. 133 "Holiday on MONTH, DAY (Julian) called STRING.
137If MONTH, DAY (Julian) is visible, the value returned is corresponding 134If MONTH, DAY (Julian) is visible, the value returned is corresponding
138Gregorian date in the form of the list (((month day year) STRING)). Returns 135Gregorian date in the form of the list (((month day year) STRING)). Returns
139nil if it is not visible in the current calendar window." 136nil if it is not visible in the current calendar window."
140 ;; We need to choose the Julian year associated with month and day 137 (let ((gdate (calendar-nongregorian-visible-p
141 ;; that might make them visible. 138 month day 'calendar-absolute-from-julian
142 ;; This is the same as holiday-hebrew, except that the test for 139 'calendar-julian-from-absolute
143 ;; which year to use is different. 140 ;; In the Gregorian case, we'd use the lower year when
144 (let* ((m1 displayed-month) 141 ;; month >= 11. In the Julian case, there is an offset
145 (y1 displayed-year) 142 ;; of two weeks (ie 1 Nov Greg = 19 Oct Julian). So we
146 (m2 displayed-month) 143 ;; use month >= 10, since it can't cause any problems.
147 (y2 displayed-year) 144 (lambda (m) (< m 10)))))
148 ;; Absolute date of first/last dates in calendar window. 145 (if gdate (list (list gdate string)))))
149 (start-date (progn
150 (increment-calendar-month m1 y1 -1)
151 (calendar-absolute-from-gregorian (list m1 1 y1))))
152 (end-date (progn
153 (increment-calendar-month m2 y2 1)
154 (calendar-absolute-from-gregorian
155 (list m2 (calendar-last-day-of-month m2 y2) y2))))
156 ;; Julian date of first/last date in calendar window.
157 (julian-start (calendar-julian-from-absolute start-date))
158 (julian-end (calendar-julian-from-absolute end-date))
159 ;; Julian year of first/last dates.
160 ;; Can only differ if displayed-month = 12, 1, 2.
161 (julian-y1 (extract-calendar-year julian-start))
162 (julian-y2 (extract-calendar-year julian-end))
163 ;; Choose which year might be visible in the window.
164 ;; Obviously it only matters when y1 and y2 differ, ie
165 ;; when the _Julian_ new year is visible.
166 ;; In the Gregorian case, we'd use y1 (the lower year)
167 ;; when month >= 11. In the Julian case, there is an offset
168 ;; of two weeks (ie 1 Nov Greg = 19 Oct Julian). So we use
169 ;; month >= 10, since it can't cause any problems.
170 (year (if (> month 9) julian-y1 julian-y2))
171 (date (calendar-gregorian-from-absolute
172 (calendar-absolute-from-julian (list month day year)))))
173 (if (calendar-date-is-visible-p date)
174 (list (list date string)))))
175 146
176;;;###cal-autoload 147;;;###cal-autoload
177(defun calendar-absolute-from-astro (d) 148(defun calendar-absolute-from-astro (d)