diff options
author | Ulrich Müller <ulm@gentoo.org> | 2023-02-12 20:57:49 +0100 |
---|---|---|
committer | Ulrich Müller <ulm@gentoo.org> | 2023-02-13 07:15:36 +0100 |
commit | cc30422825a5acf460d026bfe912b327b70dedcf (patch) | |
tree | a76e08959b9d65677d1e766de376e9d9edc44a51 | |
parent | f2114e8d89feed154a1c523c925ff2fb9fa9ba9a (diff) | |
download | emacs-cc30422825a5acf460d026bfe912b327b70dedcf.tar.gz emacs-cc30422825a5acf460d026bfe912b327b70dedcf.tar.bz2 emacs-cc30422825a5acf460d026bfe912b327b70dedcf.zip |
Fix spurious display of eclipses in Calendar
* lisp/calendar/lunar.el (eclipse-check): Don't show an eclipse
unless the phase is new moon or full moon. (bug#61460)
* test/lisp/calendar/lunar-tests.el (lunar-test-eclipse-check)
(lunar-test-phase-list): Update tests.
-rw-r--r-- | lisp/calendar/lunar.el | 4 | ||||
-rw-r--r-- | test/lisp/calendar/lunar-tests.el | 27 |
2 files changed, 18 insertions, 13 deletions
diff --git a/lisp/calendar/lunar.el b/lisp/calendar/lunar.el index 0db811417af..70681f42c90 100644 --- a/lisp/calendar/lunar.el +++ b/lisp/calendar/lunar.el @@ -161,7 +161,9 @@ remainder mod 4 gives the phase: 0 new moon, 1 first quarter, 2 full moon, (phase-name (cond ((= phase 0) "Solar") ((= phase 2) "Lunar") (t "")))) - (cond ((< moon-lat 2.42600766e-1) + (cond ((string= phase-name "") + "") + ((< moon-lat 2.42600766e-1) (concat "** " phase-name " Eclipse **")) ((< moon-lat 0.37) (concat "** " phase-name " Eclipse possible **")) diff --git a/test/lisp/calendar/lunar-tests.el b/test/lisp/calendar/lunar-tests.el index 0d66403e3b6..baae9282628 100644 --- a/test/lisp/calendar/lunar-tests.el +++ b/test/lisp/calendar/lunar-tests.el @@ -43,21 +43,24 @@ (ert-deftest lunar-test-eclipse-check () (with-lunar-test - (should (equal (eclipse-check 1 1) "** Eclipse **")))) + (should (equal (eclipse-check 10.0 1) "")) + (should (equal (eclipse-check 10.0 2) "** Lunar Eclipse **")))) (ert-deftest lunar-test-phase-list () (with-lunar-test - (should (equal (lunar-phase-list 3 1871) - '(((3 21 1871) "04:03" 0 "") - ((3 29 1871) "06:46" 1 "** Eclipse **") - ((4 5 1871) "14:20" 2 "") - ((4 12 1871) "05:57" 3 "** Eclipse possible **") - ((4 19 1871) "19:06" 0 "") - ((4 27 1871) "23:49" 1 "") - ((5 4 1871) "22:57" 2 "") - ((5 11 1871) "14:29" 3 "") - ((5 19 1871) "10:46" 0 "") - ((5 27 1871) "13:02" 1 "")))))) + (should (equal (lunar-phase-list 9 2023) + '(((9 6 2023) "22:27" 3 "") + ((9 15 2023) "01:40" 0 "") + ((9 22 2023) "19:33" 1 "") + ((9 29 2023) "09:54" 2 "** Lunar Eclipse possible **") + ((10 6 2023) "13:53" 3 "") + ((10 14 2023) "17:55" 0 "** Solar Eclipse **") + ((10 22 2023) "03:30" 1 "") + ((10 28 2023) "20:20" 2 "** Lunar Eclipse **") + ((11 5 2023) "08:42" 3 "") + ((11 13 2023) "09:27" 0 "") + ((11 20 2023) "10:51" 1 "") + ((11 27 2023) "09:13" 2 "")))))) (ert-deftest lunar-test-new-moon-time () (with-lunar-test |