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 #86 received at 61460 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Ulrich Müller <ulm <at> gentoo.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 61460 <at> debbugs.gnu.org
Subject: Re: bug#61460: 30.0.50; Calendar shows eclipse for quarter moon
Date: Fri, 17 Feb 2023 06:25:50 +0100
[Message part 1 (text/plain, inline)]
Ulrich Müller <ulm <at> gentoo.org> writes:

> Pushed to master, including your suggestion (I went for "node-dist").

Thank you very much.

> [...]
> tl;dr I suggest that we leave the values as-is, except for a small
> adjustment from 21.2 to 21.0, as in the patch included below. If there
> aren't any nobjections, I'm going to push this to master.

Fine by me.


> @Michael: Can this bug be closed then?

I have some more cosmetic changes:

[lun.diff (text/x-diff, inline)]
diff --git a/lisp/calendar/lunar.el b/lisp/calendar/lunar.el
index 1f827ca34b0..ebf9abc9d60 100644
--- a/lisp/calendar/lunar.el
+++ b/lisp/calendar/lunar.el
@@ -94,7 +94,7 @@ lunar-phase
                        (* -0.0016528 time time)
                        (* -0.00000239 time time time))
                     360.0))
-	 (eclipse (eclipse-check moon-lat phase))
+	 (eclipse (lunar-check-for-eclipse moon-lat phase))
          (adjustment
           (if (memq phase '(0 2))
               (+ (* (- 0.1734 (* 0.000393 time))
@@ -154,18 +154,18 @@ lunar-phase

 ;; from "Astronomy with your Personal Computer", Subroutine Eclipse
 ;; Line 7000 Peter Duffett-Smith Cambridge University Press 1990
-(defun eclipse-check (moon-lat phase)
-  (let* ((node-dist (mod moon-lat 180))
-         ;; Absolute angular distance from the ascending or descending
-         ;; node, whichever is nearer.
-         (node-dist (min node-dist (- 180 node-dist)))
-         (phase-name (cond ((= phase 0) "Solar")
-                           ((= phase 2) "Lunar")
-                           (t ""))))
+(defun lunar-check-for-eclipse (moon-lat phase)
+  (let ((type (cond ((= phase 0) "Solar")
+                    ((= phase 2) "Lunar")
+                    (t nil)))
+        ;; Absolute angular distance from the ascending or descending
+        ;; node, whichever is nearer.
+        (node-dist (funcall (lambda (x) (min x (- 180 x)))
+                            (mod moon-lat 180))))
     (cond
-     ((string= phase-name "") "")
-     ((< node-dist 13.9) (concat "** " phase-name " Eclipse **"))
-     ((< node-dist 21.2) (concat "** " phase-name " Eclipse possible **"))
+     ((not type) "")
+     ((< node-dist 13.9) (concat "** " type " Eclipse **"))
+     ((< node-dist 21.2) (concat "** " type " Eclipse possible **"))
      (t ""))))

 (defconst lunar-cycles-per-year 12.3685 ; 365.25/29.530588853
[Message part 3 (text/plain, inline)]
In particular, the name of the global function should start with
"lunar-".  Does that look ok?


Thanks,

Michael

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

Previous Next


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