GNU bug report logs - #61460
30.0.50; Calendar shows eclipse for quarter moon

Previous Next

Package: emacs;

Reported by: Ulrich Mueller <ulm <at> gentoo.org>

Date: Sun, 12 Feb 2023 19:58:02 UTC

Severity: normal

Found in version 30.0.50

Fixed in version 30.1

Done: Ulrich Müller <ulm <at> gentoo.org>

Bug is archived. No further changes may be made.

Full log


Message #121 received at 61460 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Ulrich Mueller <ulm <at> gentoo.org>
Cc: 61460 <at> debbugs.gnu.org
Subject: Re: bug#61460: 30.0.50; Calendar shows eclipse for quarter moon
Date: Wed, 22 Feb 2023 15:19:09 +0100
[Message part 1 (text/plain, inline)]
Ulrich Mueller <ulm <at> gentoo.org> writes:

> Use something like ‘(unless (string-empty-p eclipse) " ")’? WFM.
>
> > We also need to fix the space handling in calendar-lunar-phases aka M in
> > calendar - when no eclipse occurs, the descriptions end with a
> > trailing space.
>
> While at it, maybe replace ‘(car (last x))’ by ‘(nth 3 x)’?

I tried to do that (and a bit more):

[0001-Make-also-diary-lunar-phases-report-eclipses.patch (text/x-diff, inline)]
From f0eaa97bbc5e4a6145295a4da14606012737820e Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <michael_heerdegen <at> web.de>
Date: Wed, 22 Feb 2023 14:56:07 +0100
Subject: [PATCH] Make also 'diary-lunar-phases' report eclipses

* lisp/calendar/lunar.el (diary-lunar-phases): Report eclipses.
(calendar-lunar-phases): Tweak.
---
 lisp/calendar/lunar.el | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/lisp/calendar/lunar.el b/lisp/calendar/lunar.el
index 4f8f34d954f..b395e08c232 100644
--- a/lisp/calendar/lunar.el
+++ b/lisp/calendar/lunar.el
@@ -245,10 +245,11 @@ calendar-lunar-phases
         (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 @@ diary-lunar-phases
     (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.
--
2.30.2

[Message part 3 (text/plain, inline)]
Michael.

This bug report was last modified 2 years and 141 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.