all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: John Magolske <listmail@b79.net>
To: help-gnu-emacs@gnu.org
Subject: Challenges around displaying phase of moon in calfw
Date: Sun, 28 May 2017 01:23:13 -0700	[thread overview]
Message-ID: <20170528081730.GA17308@s70206.gridserver.com> (raw)

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



             reply	other threads:[~2017-05-28  8:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-28  8:23 John Magolske [this message]
2017-06-01  5:29 ` Challenges around displaying phase of moon in calfw 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

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=20170528081730.GA17308@s70206.gridserver.com \
    --to=listmail@b79.net \
    --cc=help-gnu-emacs@gnu.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.