diff options
| author | Michael Heerdegen | 2023-02-22 14:56:07 +0100 |
|---|---|---|
| committer | Michael Heerdegen | 2023-02-25 11:05:54 +0100 |
| commit | 309e6aaa6867cd9a33e185d929afe18a660a8151 (patch) | |
| tree | 1ee563cbbc633de9e3cad8dabfc5263215b4e215 | |
| parent | 50b55656b9c5ce0d7940bec245f2d9725378d0a0 (diff) | |
| download | emacs-309e6aaa6867cd9a33e185d929afe18a660a8151.tar.gz emacs-309e6aaa6867cd9a33e185d929afe18a660a8151.zip | |
Make also 'diary-lunar-phases' report eclipses
* lisp/calendar/lunar.el (diary-lunar-phases): Report eclipses.
(calendar-lunar-phases): Tweak.
| -rw-r--r-- | lisp/calendar/lunar.el | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lisp/calendar/lunar.el b/lisp/calendar/lunar.el index 4f8f34d954f..5b22043102d 100644 --- a/lisp/calendar/lunar.el +++ b/lisp/calendar/lunar.el | |||
| @@ -245,10 +245,11 @@ use instead of point." | |||
| 245 | (insert | 245 | (insert |
| 246 | (mapconcat | 246 | (mapconcat |
| 247 | (lambda (x) | 247 | (lambda (x) |
| 248 | (format "%s: %s %s %s" (calendar-date-string (car x)) | 248 | (let ((eclipse (nth 3 x))) |
| 249 | (lunar-phase-name (nth 2 x)) | 249 | (concat (calendar-date-string (car x)) ": " |
| 250 | (cadr x) | 250 | (lunar-phase-name (nth 2 x)) " " |
| 251 | (car (last x)))) | 251 | (cadr x) (unless (string-empty-p eclipse) " ") |
| 252 | eclipse))) | ||
| 252 | (lunar-phase-list m1 y1) "\n"))) | 253 | (lunar-phase-list m1 y1) "\n"))) |
| 253 | (message "Computing phases of the moon...done")))) | 254 | (message "Computing phases of the moon...done")))) |
| 254 | 255 | ||
| @@ -283,9 +284,13 @@ use when highlighting the day in the calendar." | |||
| 283 | (while (calendar-date-compare phase (list date)) | 284 | (while (calendar-date-compare phase (list date)) |
| 284 | (setq index (1+ index) | 285 | (setq index (1+ index) |
| 285 | phase (lunar-phase index))) | 286 | phase (lunar-phase index))) |
| 286 | (if (calendar-date-equal (car phase) date) | 287 | (and (calendar-date-equal (car phase) date) |
| 287 | (cons mark (concat (lunar-phase-name (nth 2 phase)) " " | 288 | (cons mark |
| 288 | (cadr phase)))))) | 289 | (let ((eclipse (nth 3 phase))) |
| 290 | (concat (lunar-phase-name (nth 2 phase)) " " | ||
| 291 | (cadr phase) | ||
| 292 | (unless (string-empty-p eclipse) " ") | ||
| 293 | eclipse)))))) | ||
| 289 | 294 | ||
| 290 | ;; For the Chinese calendar the calculations for the new moon need to be more | 295 | ;; For the Chinese calendar the calculations for the new moon need to be more |
| 291 | ;; accurate than those above, so we use more terms in the approximation. | 296 | ;; accurate than those above, so we use more terms in the approximation. |