all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: "Ulrich Müller" <ulm@gentoo.org>
Cc: Eli Zaretskii <eliz@gnu.org>, 61460@debbugs.gnu.org
Subject: bug#61460: 30.0.50; Calendar shows eclipse for quarter moon
Date: Fri, 17 Feb 2023 06:25:50 +0100	[thread overview]
Message-ID: <87pma8q2w1.fsf@web.de> (raw)
In-Reply-To: <umt5d9x1r@gentoo.org> ("Ulrich Müller"'s message of "Thu, 16 Feb 2023 21:26:24 +0100")

[-- Attachment #1: Type: text/plain, Size: 457 bytes --]

Ulrich Müller <ulm@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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: lun.diff --]
[-- Type: text/x-diff, Size: 1934 bytes --]

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

[-- Attachment #3: Type: text/plain, Size: 115 bytes --]


In particular, the name of the global function should start with
"lunar-".  Does that look ok?


Thanks,

Michael

  reply	other threads:[~2023-02-17  5:25 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-12 19:57 bug#61460: 30.0.50; Calendar shows eclipse for quarter moon Ulrich Mueller
2023-02-12 20:07 ` Ulrich Müller
2023-02-12 20:19   ` Eli Zaretskii
2023-02-12 21:13     ` Ulrich Mueller
2023-02-13  3:24       ` Eli Zaretskii
2023-02-13  3:25   ` Michael Heerdegen
2023-02-13  4:52     ` Michael Heerdegen
2023-02-13  5:13     ` Michael Heerdegen
2023-02-13  6:01       ` Michael Heerdegen
2023-02-13  7:28       ` Ulrich Mueller
2023-02-13  8:13         ` Michael Heerdegen
2023-02-13  8:52           ` Michael Heerdegen
2023-02-13  9:34             ` Ulrich Mueller
2023-02-13 10:04               ` Michael Heerdegen
2023-02-13 13:03                 ` Eli Zaretskii
2023-02-13 13:30                   ` Ulrich Mueller
2023-02-13 14:05                     ` Eli Zaretskii
2023-02-14  5:30               ` Michael Heerdegen
2023-02-14  7:59                 ` Ulrich Mueller
2023-02-14  9:15                   ` Michael Heerdegen
2023-02-14 10:22                     ` Ulrich Müller
2023-02-14 10:56                       ` Michael Heerdegen
2023-02-16 20:26                         ` Ulrich Müller
2023-02-17  5:25                           ` Michael Heerdegen [this message]
2023-02-17  7:03                             ` Ulrich Müller
2023-02-17  7:20                               ` Michael Heerdegen
2023-02-18  5:53                                 ` Michael Heerdegen
2023-02-18  8:56                                   ` Ulrich Mueller
2023-02-18  9:16                                     ` Michael Heerdegen
2023-02-21 15:15                                       ` Michael Heerdegen
2023-02-22  9:00                                         ` Ulrich Mueller
2023-02-22  9:45                                           ` Andreas Schwab
2023-02-22 10:03                                           ` Michael Heerdegen
2023-02-22 11:32                                             ` Ulrich Mueller
2023-02-22 14:19                                               ` Michael Heerdegen
2023-02-22 15:46                                                 ` Ulrich Mueller
2023-02-22 16:26                                                   ` Michael Heerdegen
2023-02-25 16:13                                                     ` Michael Heerdegen
2023-02-14 13:31                       ` Eli Zaretskii
2023-02-14 10:49                     ` Ulrich Mueller
2023-02-13  6:21     ` Ulrich Mueller
2023-02-13  7:08       ` Michael Heerdegen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pma8q2w1.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=61460@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=ulm@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.