summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Heerdegen <michael_heerdegen@web.de>2023-02-22 14:56:07 +0100
committerMichael Heerdegen <michael_heerdegen@web.de>2023-02-25 11:05:54 +0100
commit309e6aaa6867cd9a33e185d929afe18a660a8151 (patch)
tree1ee563cbbc633de9e3cad8dabfc5263215b4e215
parent50b55656b9c5ce0d7940bec245f2d9725378d0a0 (diff)
downloademacs-309e6aaa6867cd9a33e185d929afe18a660a8151.tar.gz
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.el19
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."
(insert
(mapconcat
(lambda (x)
- (format "%s: %s %s %s" (calendar-date-string (car x))
- (lunar-phase-name (nth 2 x))
- (cadr x)
- (car (last x))))
+ (let ((eclipse (nth 3 x)))
+ (concat (calendar-date-string (car x)) ": "
+ (lunar-phase-name (nth 2 x)) " "
+ (cadr x) (unless (string-empty-p eclipse) " ")
+ eclipse)))
(lunar-phase-list m1 y1) "\n")))
(message "Computing phases of the moon...done"))))
@@ -283,9 +284,13 @@ use when highlighting the day in the calendar."
(while (calendar-date-compare phase (list date))
(setq index (1+ index)
phase (lunar-phase index)))
- (if (calendar-date-equal (car phase) date)
- (cons mark (concat (lunar-phase-name (nth 2 phase)) " "
- (cadr phase))))))
+ (and (calendar-date-equal (car phase) date)
+ (cons mark
+ (let ((eclipse (nth 3 phase)))
+ (concat (lunar-phase-name (nth 2 phase)) " "
+ (cadr phase)
+ (unless (string-empty-p eclipse) " ")
+ eclipse))))))
;; For the Chinese calendar the calculations for the new moon need to be more
;; accurate than those above, so we use more terms in the approximation.