-;;; lunar.el --- calendar functions for phases of the moon.
+;;; lunar.el --- calendar functions for phases of the moon
-;; Copyright (C) 1992, 1993, 1995 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1993, 1995, 1997 Free Software Foundation, Inc.
;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
;; Keywords: calendar
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
;;; Commentary:
;; The author would be delighted to have an astronomically more sophisticated
;; person rewrite the code for the lunar calculations in this file!
+;; Technical details of all the calendrical calculations can be found in
+;; ``Calendrical Calculations: The Millennium Edition'' by Edward M. Reingold
+;; and Nachum Dershowitz, Cambridge University Press (2001).
+
;; Comments, corrections, and improvements should be sent to
;; Edward M. Reingold Department of Computer Science
;; (217) 333-6733 University of Illinois at Urbana-Champaign
;;; Code:
+(defvar date)
+(defvar displayed-month)
+(defvar displayed-year)
+
(if (fboundp 'atan)
(require 'lisp-float-type)
- (error "Lunar calculations impossible since floating point is unavailable."))
+ (error "Lunar calculations impossible since floating point is unavailable"))
(require 'solar)
(increment-calendar-month end-month end-year 3)
(increment-calendar-month start-month start-year -1)
(let* ((end-date (list (list end-month 1 end-year)))
- (start-date (list (list start-month
+ (start-date (list (list start-month
(calendar-last-day-of-month
start-month start-year)
start-year)))
(displayed-year (extract-calendar-year date)))
(calendar-phases-of-moon))))
-(defun diary-phases-of-moon ()
- "Moon phases diary entry."
+(defun diary-phases-of-moon (&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 (* 4
(truncate
(* 12.3685
(setq index (1+ index))
(setq phase (lunar-phase index)))
(if (calendar-date-equal (car phase) date)
- (concat (lunar-phase-name (car (cdr (cdr phase)))) " "
- (car (cdr phase))))))
+ (cons mark (concat (lunar-phase-name (car (cdr (cdr phase)))) " "
+ (car (cdr phase)))))))
;; For the Chinese calendar the calculations for the new moon need to be more
(provide 'lunar)
+;;; arch-tag: 72f0b8a4-7bcc-4a1b-b67a-ff53c4a1d222
;;; lunar.el ends here