]> code.delx.au - gnu-emacs/blobdiff - lisp/calendar/lunar.el
New file, from: Anna M. Bigatti <bigatti at dima.unige.it>.
[gnu-emacs] / lisp / calendar / lunar.el
index a076f0b88c54d72364da32dc35cf7e82252a0a88..dd2f546fc378252fe734e38d52f3964e462ee845 100644 (file)
@@ -1,8 +1,10 @@
 ;;; lunar.el --- calendar functions for phases of the moon
 
-;; Copyright (C) 1992, 1993, 1995, 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1993, 1995, 1997, 2001, 2002, 2003, 2004, 2005,
+;;   2006  Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
+;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: moon, lunar phases, calendar, diary
 
@@ -20,8 +22,8 @@
 
 ;; 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:
 
@@ -38,8 +40,8 @@
 ;; person rewrite the code for the lunar calculations in this file!
 
 ;; Technical details of all the calendrical calculations can be found in
-;; ``Calendrical Calculations'' by Nachum Dershowitz and Edward M. Reingold,
-;; Cambridge University Press (1997).
+;; ``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
 
 ;;; 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"))
@@ -64,7 +70,7 @@
     (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)))
@@ -236,8 +242,11 @@ This function is suitable for execution in a .emacs file."
            (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
@@ -250,8 +259,8 @@ This function is suitable for execution in a .emacs file."
       (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
@@ -392,4 +401,5 @@ calendar-time-zone."
 
 (provide 'lunar)
 
+;;; arch-tag: 72f0b8a4-7bcc-4a1b-b67a-ff53c4a1d222
 ;;; lunar.el ends here