help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Challenges around displaying phase of moon in calfw


From: John Magolske
Subject: Challenges around displaying phase of moon in calfw
Date: Sun, 28 May 2017 01:23:13 -0700
User-agent: Mutt/1.5.23 (2014-03-12)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]