* Challenges around displaying phase of moon in calfw
@ 2017-05-28 8:23 John Magolske
2017-06-01 5:29 ` John Magolske
0 siblings, 1 reply; 9+ messages in thread
From: John Magolske @ 2017-05-28 8:23 UTC (permalink / raw)
To: help-gnu-emacs
To display phases of the moon in calfw, I placed this in a file in my
org-agenda-files directory:
%%(diary-lunar-phases)
And set this:
;; shorter moon phase names to better fit into calfw. Using ◯ for
;; "New Moon" and ● for "Full moon" as this for a light text on dark
;; background terminal, reverse these for dark text on light background
(setq lunar-phase-names '("◯ New" "◐ q1↑" "● Full" "◑ q3↓"))
Which works nicely -- the lunar phases show up in calfw, but for some
reason the time is displayed twice, like so:
19:48 ◐ q1↑ 7:48pm (PDT)
14:40 ● Full 2:40pm (PDT)
12:46 ◯ New 12:46pm (PDT)
I think what's going on is that each phase is considered an event
which somehow gets prefixed with its time in 24hr format...but
I can't figure out what to set to turn that off. For now I just
remove the time stamps altogether by placing a modified version of
diary-lunar-phases in my init file:
(with-eval-after-load 'lunar
(defun diary-lunar-phases (&optional mark)
(let* ((index (lunar-index date))
(phase (lunar-phase index)))
(while (calendar-date-compare phase (list date))
(setq index (1+ index)
phase (lunar-phase index)))
(if (calendar-date-equal (car phase) date)
(cons mark (lunar-phase-name (nth 2 phase)))))))
The original from lunar.el looks like this:
;; To be called from diary-list-sexp-entries, where DATE is bound.
;;;###diary-autoload
(defun diary-lunar-phases (&optional mark)
"Moon phases diary entry.
An optional parameter MARK specifies a face or single-character string to
use when highlighting the day in the calendar."
(let* ((index (lunar-index date))
(phase (lunar-phase index)))
(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))))))
It would be nice to keep the time of day for lunar phases, with
something like this displayed:
◐ q1↑ 7:48pm (PDT)
● Full 2:40pm (PDT)
◯ New 12:46pm (PDT)
Any suggestions much appreciated.
John
--
John Magolske
http://b79.net/contact
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Challenges around displaying phase of moon in calfw
2017-05-28 8:23 Challenges around displaying phase of moon in calfw John Magolske
@ 2017-06-01 5:29 ` John Magolske
2017-06-01 14:43 ` Jude DaShiell
2017-06-04 2:13 ` John Magolske
0 siblings, 2 replies; 9+ messages in thread
From: John Magolske @ 2017-06-01 5:29 UTC (permalink / raw)
To: help-gnu-emacs
* John Magolske <listmail@b79.net> [170528 02:05]:
> [...] the lunar phases show up in calfw, but for some
> reason the time is displayed twice, like so:
>
> 19:48 ◐ q1↑ 7:48pm (PDT)
> 14:40 ● Full 2:40pm (PDT)
> 12:46 ◯ New 12:46pm (PDT)
>
> I think what's going on is that each phase is considered an event
> which somehow gets prefixed with its time in 24hr format...
I'm wondering if this issue may be related to this post on emacs-devel:
calendar/diary/appt: diary-lunar-phases should not create appointments
Hi,
I have
&%%(diary-sunrise-sunset)
&%%(diary-lunar-phases)
which results in emacs nagging me about moon phases and sunsets.
I don't think this is right: I want to be able to see the times when the
lunar phases and sunsets happen (and, btw, moon rises and moon sets, but
they are not available), but I do not want to do anything when they
actually do happen.
Is there a way to prevent some diary entries containing times from being
interpreted as appointments?
url:
https://lists.gnu.org/archive/html/emacs-devel/2011-11/msg00329.html
no resolution...picked up again a few years later:
https://lists.gnu.org/archive/html/emacs-devel/2015-02/msg01347.html
... still no resolution.
John
--
John Magolske
http://b79.net/contact
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Challenges around displaying phase of moon in calfw
2017-06-01 5:29 ` John Magolske
@ 2017-06-01 14:43 ` Jude DaShiell
2017-06-01 14:51 ` Óscar Fuentes
2017-06-04 2:13 ` John Magolske
1 sibling, 1 reply; 9+ messages in thread
From: Jude DaShiell @ 2017-06-01 14:43 UTC (permalink / raw)
To: John Magolske, help-gnu-emacs
The moon has eight phases not four as do all other planet combinations
and this is where pom from bsd along with most moon phase programs got
it wrong. That's what happens when programmers didn't study enough
astrology though.
On Wed, 31 May 2017, John Magolske wrote:
> Date: Thu, 1 Jun 2017 01:29:12
> From: John Magolske <listmail@b79.net>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Challenges around displaying phase of moon in calfw
>
> * John Magolske <listmail@b79.net> [170528 02:05]:
>
>> [...] the lunar phases show up in calfw, but for some
>> reason the time is displayed twice, like so:
>>
>> 19:48 ? q1? 7:48pm (PDT)
>> 14:40 ? Full 2:40pm (PDT)
>> 12:46 ? New 12:46pm (PDT)
>>
>> I think what's going on is that each phase is considered an event
>> which somehow gets prefixed with its time in 24hr format...
>
> I'm wondering if this issue may be related to this post on emacs-devel:
>
> calendar/diary/appt: diary-lunar-phases should not create appointments
>
> Hi,
>
> I have
>
> &%%(diary-sunrise-sunset)
> &%%(diary-lunar-phases)
>
> which results in emacs nagging me about moon phases and sunsets.
> I don't think this is right: I want to be able to see the times when the
> lunar phases and sunsets happen (and, btw, moon rises and moon sets, but
> they are not available), but I do not want to do anything when they
> actually do happen.
>
> Is there a way to prevent some diary entries containing times from being
> interpreted as appointments?
>
> url:
>
> https://lists.gnu.org/archive/html/emacs-devel/2011-11/msg00329.html
> no resolution...picked up again a few years later:
> https://lists.gnu.org/archive/html/emacs-devel/2015-02/msg01347.html
> ... still no resolution.
>
> John
>
>
>
--
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Challenges around displaying phase of moon in calfw
2017-06-01 14:43 ` Jude DaShiell
@ 2017-06-01 14:51 ` Óscar Fuentes
2017-06-01 15:13 ` tomas
2017-06-01 15:40 ` Jude DaShiell
0 siblings, 2 replies; 9+ messages in thread
From: Óscar Fuentes @ 2017-06-01 14:51 UTC (permalink / raw)
To: help-gnu-emacs
Jude DaShiell <jdashiel@panix.com> writes:
> The moon has eight phases not four as do all other planet combinations
> and this is where pom from bsd along with most moon phase programs got
> it wrong. That's what happens when programmers didn't study enough
> astrology though.
Astrology?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Challenges around displaying phase of moon in calfw
2017-06-01 14:51 ` Óscar Fuentes
@ 2017-06-01 15:13 ` tomas
2017-06-01 15:40 ` Jude DaShiell
1 sibling, 0 replies; 9+ messages in thread
From: tomas @ 2017-06-01 15:13 UTC (permalink / raw)
To: Óscar Fuentes; +Cc: help-gnu-emacs
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thu, Jun 01, 2017 at 04:51:44PM +0200, Óscar Fuentes wrote:
> Jude DaShiell <jdashiel@panix.com> writes:
>
> > The moon has eight phases not four as do all other planet combinations
> > and this is where pom from bsd along with most moon phase programs got
> > it wrong. That's what happens when programmers didn't study enough
> > astrology though.
>
> Astrology?
I'd guess in "astronomy" the moon's phases form a continuum (whatever
that means in physics, but let's avoid *that* rabbit hole, shall we?)
(not being really serious, mind you)
Cheers
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iEYEARECAAYFAlkwLvwACgkQBcgs9XrR2kb5TgCeIrHDQr+SOJIyaHhv79U8IlpK
lOoAnR2zw+IWJUBWBexzw8tuzlrhZwIw
=PLih
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Challenges around displaying phase of moon in calfw
2017-06-01 14:51 ` Óscar Fuentes
2017-06-01 15:13 ` tomas
@ 2017-06-01 15:40 ` Jude DaShiell
2017-06-01 16:05 ` Óscar Fuentes
1 sibling, 1 reply; 9+ messages in thread
From: Jude DaShiell @ 2017-06-01 15:40 UTC (permalink / raw)
To: Óscar Fuentes, help-gnu-emacs
Where did you think the concept of phases came from? Those were around
long before astrologers created astronomy.
On Thu, 1 Jun 2017, ?scar Fuentes wrote:
> Date: Thu, 1 Jun 2017 10:51:44
> From: ?scar Fuentes <ofv@wanadoo.es>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Challenges around displaying phase of moon in calfw
>
> Jude DaShiell <jdashiel@panix.com> writes:
>
>> The moon has eight phases not four as do all other planet combinations
>> and this is where pom from bsd along with most moon phase programs got
>> it wrong. That's what happens when programmers didn't study enough
>> astrology though.
>
> Astrology?
>
>
>
--
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Challenges around displaying phase of moon in calfw
2017-06-01 15:40 ` Jude DaShiell
@ 2017-06-01 16:05 ` Óscar Fuentes
2017-06-01 20:30 ` John Ankarström
0 siblings, 1 reply; 9+ messages in thread
From: Óscar Fuentes @ 2017-06-01 16:05 UTC (permalink / raw)
To: help-gnu-emacs
Jude DaShiell <jdashiel@panix.com> writes:
> Where did you think the concept of phases came from? Those were around
> long before astrologers created astronomy.
Do you really suggest that programmers should devote their learning time
to study astrology for knowing what the phases of the moon are? And for
predicting the future too, I guess.
I'm seeing the new fad that will replace Machine Learning:
Astrology-based Event Anticipation.
Seriously, all current scientific fields with a long enough historic
background have their roots on superstition and story-telling. The
phases of the moon is a perfectly fine astronomic concept. There is no
need to waste time on learning fake knowledge, except for the sake of
studying fake knowledge itself, that is.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Challenges around displaying phase of moon in calfw
2017-06-01 16:05 ` Óscar Fuentes
@ 2017-06-01 20:30 ` John Ankarström
0 siblings, 0 replies; 9+ messages in thread
From: John Ankarström @ 2017-06-01 20:30 UTC (permalink / raw)
To: help-gnu-emacs
Óscar Fuentes <ofv@wanadoo.es> writes:
> Do you really suggest that programmers should devote their learning time
> to study astrology for knowing what the phases of the moon are? And for
> predicting the future too, I guess.
Well, if the goal is to programmatically figure out the phases
of the moon, it sure helps to study the (astrological) definition
of the phases of the moon :-)
- John
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Challenges around displaying phase of moon in calfw
2017-06-01 5:29 ` John Magolske
2017-06-01 14:43 ` Jude DaShiell
@ 2017-06-04 2:13 ` John Magolske
1 sibling, 0 replies; 9+ messages in thread
From: John Magolske @ 2017-06-04 2:13 UTC (permalink / raw)
To: help-gnu-emacs
Ok, hacked together a workaround...
* John Magolske <listmail@b79.net> [170601 00:32]:
> * John Magolske <listmail@b79.net> [170528 02:05]:
>
> > [...] the lunar phases show up in calfw, but for some
> > reason the time is displayed twice, like so:
> >
> > 19:48 ◐ q1↑ 7:48pm (PDT)
> > 14:40 ● Full 2:40pm (PDT)
> > 12:46 ◯ New 12:46pm (PDT)
>
> [...]
>
> I'm wondering if this issue may be related to this post on emacs-devel:
>
> calendar/diary/appt: diary-lunar-phases should not create appointments
> [...]
> https://lists.gnu.org/archive/html/emacs-devel/2011-11/msg00329.html
> no resolution...picked up again a few years later:
> https://lists.gnu.org/archive/html/emacs-devel/2015-02/msg01347.html
I see this does appear to be the same issue mentioned in the emacs-devel
posts as well (thanks to an off-list exchange with Toto). Apparently
with time shown, an appointment is created out of the diary entry.
So I edited the output of lunar.el to show these times substituting
∶ (RATIO, U+2236) for : (COLON, U+003A), a for am, and p for pm.
This way they aren't recognized at "times" and the time doesn't show
up twice in calfw. Also got rid of the parenthesis around time zones
to keep things concise. Below is the modified version of lunar.el as
placed in my init file, displays in calfw like so:
◐ q1↑ 7:48p PDT
● Full 2:40p PDT
◯ New 12:46p PDT
Cheers,
John
----
(with-eval-after-load 'lunar
(defun diary-lunar-phases (&optional mark)
"Moon phases diary entry.
An optional parameter MARK specifies a face or single-character string to
use when highlighting the day in the calendar.
Note: edited from lunar.el, changed the part that calls out hour of lunar
phase substituting ∶ (RATIO, U+2236) for : (COLON, U+003A), a for am, p for pm
so that lunar phase times aren't recognized as timestamps. Otherwise appointment
will be created out of these diary entries and times will show up twice in calfw.
Also removed the parenthesis around timezone to shorten what's displayed."
(let* ((index (lunar-index date))
(phase (lunar-phase index)))
(while (calendar-date-compare phase (list date))
(setq index (1+ index)
phase (lunar-phase index)))
(if (calendar-date-equal (car phase) date)
;; (cons mark (lunar-phase-name (nth 2 phase)))))))
(cons
mark
(concat
(lunar-phase-name (nth 2 phase)) " "
(replace-regexp-in-string
":" "∶"
(replace-regexp-in-string
"am" "a"
(replace-regexp-in-string
"pm" "p"
(replace-regexp-in-string
"(" ""
(replace-regexp-in-string
")" ""
(cadr phase))))))
))))))
--
John Magolske
http://b79.net/contact
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-06-04 2:13 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-28 8:23 Challenges around displaying phase of moon in calfw John Magolske
2017-06-01 5:29 ` John Magolske
2017-06-01 14:43 ` Jude DaShiell
2017-06-01 14:51 ` Óscar Fuentes
2017-06-01 15:13 ` tomas
2017-06-01 15:40 ` Jude DaShiell
2017-06-01 16:05 ` Óscar Fuentes
2017-06-01 20:30 ` John Ankarström
2017-06-04 2:13 ` John Magolske
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).