Function: calendar-lunar-phases

calendar-lunar-phases is an autoloaded, interactive and byte-compiled function defined in lunar.el.gz.

Signature

(calendar-lunar-phases &optional EVENT)

Documentation

Create a buffer with the lunar phases for the current calendar window.

If EVENT is non-nil, it's an event indicating the buffer position to use instead of point.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/lunar.el.gz
;;;###cal-autoload
(defun calendar-lunar-phases (&optional event)
  "Create a buffer with the lunar phases for the current calendar window.
If EVENT is non-nil, it's an event indicating the buffer position to
use instead of point."
  (interactive (list last-nonmenu-event))
  ;; If called from a menu, with the calendar window not selected.
  (with-current-buffer
      (if event (window-buffer (posn-window (event-start event)))
        (current-buffer))
    (message "Computing phases of the moon...")
    (let ((m1 displayed-month)
          (y1 displayed-year)
          (m2 displayed-month)
          (y2 displayed-year))
      (calendar-increment-month m1 y1 -1)
      (calendar-increment-month m2 y2 1)
      (calendar-in-read-only-buffer lunar-phases-buffer
        (calendar-set-mode-line
         (if (= y1 y2)
             (format "Phases of the Moon from %s to %s, %d%%-"
                     (calendar-month-name m1) (calendar-month-name m2) y2)
           (format "Phases of the Moon from %s, %d to %s, %d%%-"
                   (calendar-month-name m1) y1 (calendar-month-name m2) y2)))
        (insert
         (mapconcat
          (lambda (x)
            (format "%s: %s %s %s" (calendar-date-string (car x))
                    (lunar-phase-name (nth 2 x))
                    (cadr x)
		    (car (last x))))
          (lunar-phase-list m1 y1) "\n")))
      (message "Computing phases of the moon...done"))))