diff options
| author | Glenn Morris | 2008-03-13 03:55:15 +0000 |
|---|---|---|
| committer | Glenn Morris | 2008-03-13 03:55:15 +0000 |
| commit | 863ad01b09b51e2047643ef83c03e32a83612e12 (patch) | |
| tree | 24ce8b2b3b9c31aeae723a522bb9fc820e44a0f4 | |
| parent | 8ab36f55db9ca75f5a5a3e7ae7f12abdddd44c7b (diff) | |
| download | emacs-863ad01b09b51e2047643ef83c03e32a83612e12.tar.gz emacs-863ad01b09b51e2047643ef83c03e32a83612e12.zip | |
Re-format comments.
(calendar-julian-from-absolute): Use xerop.
(displayed-month, displayed-year): Move declarations where needed.
(calendar-print-astro-day-number): Doc fix.
| -rw-r--r-- | lisp/calendar/cal-julian.el | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lisp/calendar/cal-julian.el b/lisp/calendar/cal-julian.el index d8752cb03a7..36cff188755 100644 --- a/lisp/calendar/cal-julian.el +++ b/lisp/calendar/cal-julian.el | |||
| @@ -36,9 +36,6 @@ | |||
| 36 | 36 | ||
| 37 | ;;; Code: | 37 | ;;; Code: |
| 38 | 38 | ||
| 39 | (defvar displayed-month) | ||
| 40 | (defvar displayed-year) | ||
| 41 | |||
| 42 | (require 'calendar) | 39 | (require 'calendar) |
| 43 | 40 | ||
| 44 | ;;;###autoload | 41 | ;;;###autoload |
| @@ -46,24 +43,24 @@ | |||
| 46 | "Compute the Julian (month day year) corresponding to the absolute DATE. | 43 | "Compute the Julian (month day year) corresponding to the absolute DATE. |
| 47 | The absolute date is the number of days elapsed since the (imaginary) | 44 | The absolute date is the number of days elapsed since the (imaginary) |
| 48 | Gregorian date Sunday, December 31, 1 BC." | 45 | Gregorian date Sunday, December 31, 1 BC." |
| 49 | (let* ((approx (/ (+ date 2) 366));; Approximation from below. | 46 | (let* ((approx (/ (+ date 2) 366)) ; approximation from below |
| 50 | (year ;; Search forward from the approximation. | 47 | (year ; search forward from the approximation |
| 51 | (+ approx | 48 | (+ approx |
| 52 | (calendar-sum y approx | 49 | (calendar-sum y approx |
| 53 | (>= date (calendar-absolute-from-julian (list 1 1 (1+ y)))) | 50 | (>= date (calendar-absolute-from-julian (list 1 1 (1+ y)))) |
| 54 | 1))) | 51 | 1))) |
| 55 | (month ;; Search forward from January. | 52 | (month ; search forward from January |
| 56 | (1+ (calendar-sum m 1 | 53 | (1+ (calendar-sum m 1 |
| 57 | (> date | 54 | (> date |
| 58 | (calendar-absolute-from-julian | 55 | (calendar-absolute-from-julian |
| 59 | (list m | 56 | (list m |
| 60 | (if (and (= m 2) (= (% year 4) 0)) | 57 | (if (and (= m 2) (zerop (% year 4))) |
| 61 | 29 | 58 | 29 |
| 62 | (aref [31 28 31 30 31 30 31 31 30 31 30 31] | 59 | (aref [31 28 31 30 31 30 31 31 30 31 30 31] |
| 63 | (1- m))) | 60 | (1- m))) |
| 64 | year))) | 61 | year))) |
| 65 | 1))) | 62 | 1))) |
| 66 | (day ;; Calculate the day by subtraction. | 63 | (day ; calculate the day by subtraction |
| 67 | (- date (1- (calendar-absolute-from-julian (list month 1 year)))))) | 64 | (- date (1- (calendar-absolute-from-julian (list month 1 year)))))) |
| 68 | (list month day year))) | 65 | (list month day year))) |
| 69 | 66 | ||
| @@ -77,7 +74,7 @@ The Gregorian date Sunday, December 31, 1 BC is imaginary." | |||
| 77 | (if (and (zerop (% year 100)) | 74 | (if (and (zerop (% year 100)) |
| 78 | (/= (% year 400) 0) | 75 | (/= (% year 400) 0) |
| 79 | (> month 2)) | 76 | (> month 2)) |
| 80 | 1 0);; Correct for Julian but not Gregorian leap year. | 77 | 1 0) ; correct for Julian but not Gregorian leap year |
| 81 | (* 365 (1- year)) | 78 | (* 365 (1- year)) |
| 82 | (/ (1- year) 4) | 79 | (/ (1- year) 4) |
| 83 | -2))) | 80 | -2))) |
| @@ -136,8 +133,11 @@ Driven by the variable `calendar-date-display-form'." | |||
| 136 | (calendar-absolute-from-julian date))) | 133 | (calendar-absolute-from-julian date))) |
| 137 | (or noecho (calendar-print-julian-date))) | 134 | (or noecho (calendar-print-julian-date))) |
| 138 | 135 | ||
| 136 | (defvar displayed-month) | ||
| 137 | (defvar displayed-year) | ||
| 138 | |||
| 139 | (defun holiday-julian (month day string) | 139 | (defun holiday-julian (month day string) |
| 140 | "Holiday on MONTH, DAY (Julian) called STRING. | 140 | "Holiday on MONTH, DAY (Julian) called STRING. |
| 141 | If MONTH, DAY (Julian) is visible, the value returned is corresponding | 141 | If MONTH, DAY (Julian) is visible, the value returned is corresponding |
| 142 | Gregorian date in the form of the list (((month day year) STRING)). Returns | 142 | Gregorian date in the form of the list (((month day year) STRING)). Returns |
| 143 | nil if it is not visible in the current calendar window." | 143 | nil if it is not visible in the current calendar window." |
| @@ -192,7 +192,7 @@ Defaults to today's date if DATE is not given." | |||
| 192 | 192 | ||
| 193 | ;;;###autoload | 193 | ;;;###autoload |
| 194 | (defun calendar-print-astro-day-number () | 194 | (defun calendar-print-astro-day-number () |
| 195 | "Show astronomical (Julian) day number after noon UTC on date shown by cursor." | 195 | "Show astronomical (Julian) day number after noon UTC on cursor date." |
| 196 | (interactive) | 196 | (interactive) |
| 197 | (message | 197 | (message |
| 198 | "Astronomical (Julian) day number (at noon UTC): %s.0" | 198 | "Astronomical (Julian) day number (at noon UTC): %s.0" |