Subject: bug#61460: 30.0.50; Calendar shows eclipse for quarter moon

From: Ulrich Mueller <[email-masked]>
Date: Wed, 22 Feb 2023 10:00:38 +0100

>>>>> On Tue, 21 Feb 2023, Michael Heerdegen wrote:

>> That remark made me think about whether we want a `diary-eclipses' - or
>> teach `diary-lunar-phases' to report eclipses (at the moment the latter
>> doesn't report eclipses, I just tried).

> Seems getting the latter is quite simple:

> -        (cons mark (concat (lunar-phase-name (nth 2 phase)) " "
> -                           (cadr phase))))))
> +        (cons mark
> +              (let ((eclipse (nth 3 phase)))
> +                (concat (lunar-phase-name (nth 2 phase)) " "
> +                        (cadr phase)
> +                        (if (string-empty-p eclipse)
> +                            ""
> +                          (concat " " eclipse))))))))

It is probably a matter of personal taste, but I dislike the nested
concats. This seems simpler (not tested, though):

-        (cons mark (concat (lunar-phase-name (nth 2 phase)) " "
-                           (cadr phase))))))
+        (cons mark
+              (let ((eclipse (nth 3 phase)))
+                (concat (lunar-phase-name (nth 2 phase)) " "
+                        (cadr phase)
+                        (if (string-empty-p eclipse) "" " ")
+                        eclipse))))))