all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* 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

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

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.