emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/calendar/solar.el,v


From: Glenn Morris
Subject: [Emacs-diffs] Changes to emacs/lisp/calendar/solar.el,v
Date: Fri, 07 Mar 2008 05:16:39 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Glenn Morris <gm>       08/03/07 05:16:38

Index: solar.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/calendar/solar.el,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -b -r1.65 -r1.66
--- solar.el    8 Jan 2008 20:44:05 -0000       1.65
+++ solar.el    7 Mar 2008 05:16:37 -0000       1.66
@@ -61,16 +61,16 @@
 
 (if (fboundp 'atan)
     (require 'lisp-float-type)
-  (error "Solar/lunar calculations impossible since floating point is 
unavailable"))
+  (error "Solar calculations impossible since floating point is unavailable"))
 
 (require 'cal-dst)
 (require 'cal-julian)
 
-;;;###autoload
+
 (defcustom calendar-time-display-form
   '(12-hours ":" minutes am-pm
     (if time-zone " (") time-zone (if time-zone ")"))
-  "*The pseudo-pattern that governs the way a time of day is formatted.
+  "The pseudo-pattern that governs the way a time of day is formatted.
 
 A pseudo-pattern is a list of expressions that can involve the keywords
 `12-hours', `24-hours', and `minutes', all numbers in string form,
@@ -85,9 +85,8 @@
   :type 'sexp
   :group 'calendar)
 
-;;;###autoload
 (defcustom calendar-latitude nil
-  "*Latitude of `calendar-location-name' in degrees.
+  "Latitude of `calendar-location-name' in degrees.
 
 The value can be either a decimal fraction (one place of accuracy is
 sufficient), + north, - south, such as 40.7 for New York City, or the value
@@ -105,9 +104,8 @@
                                 (const south))))
   :group 'calendar)
 
-;;;###autoload
 (defcustom calendar-longitude nil
-  "*Longitude of `calendar-location-name' in degrees.
+  "Longitude of `calendar-location-name' in degrees.
 
 The value can be either a decimal fraction (one place of accuracy is
 sufficient), + east, - west, such as -73.9 for New York City, or the value
@@ -125,27 +123,6 @@
                                 (const west))))
   :group 'calendar)
 
-(defsubst calendar-latitude ()
-  "Convert calendar-latitude to a signed decimal fraction, if needed."
-  (if (numberp calendar-latitude)
-      calendar-latitude
-    (let ((lat (+ (aref calendar-latitude 0)
-                  (/ (aref calendar-latitude 1) 60.0))))
-      (if (equal (aref calendar-latitude 2) 'north)
-          lat
-        (- lat)))))
-
-(defsubst calendar-longitude ()
-  "Convert calendar-longitude to a signed decimal fraction, if needed."
-  (if (numberp calendar-longitude)
-      calendar-longitude
-    (let ((long (+ (aref calendar-longitude 0)
-                  (/ (aref calendar-longitude 1) 60.0))))
-      (if (equal (aref calendar-longitude 2) 'east)
-          long
-        (- long)))))
-
-;;;###autoload
 (defcustom calendar-location-name
   '(let ((float-output-format "%.1f"))
      (format "%s%s, %s%s"
@@ -163,7 +140,7 @@
              (if (numberp calendar-longitude)
                  (if (> calendar-longitude 0) "E" "W")
                (if (equal (aref calendar-longitude 2) 'east) "E" "W"))))
-  "*Expression evaluating to name of `calendar-longitude', `calendar-latitude'.
+  "Expression evaluating to name of `calendar-longitude', `calendar-latitude'.
 For example, \"New York City\".  Default value is just the latitude, longitude
 pair.
 
@@ -172,7 +149,7 @@
   :group 'calendar)
 
 (defcustom solar-error 0.5
-"*Tolerance (in minutes) for sunrise/sunset calculations.
+"Tolerance (in minutes) for sunrise/sunset calculations.
 
 A larger value makes the calculations for sunrise/sunset faster, but less
 accurate.  The default is half a minute (30 seconds), so that sunrise/sunset
@@ -186,6 +163,16 @@
   :type 'number
   :group 'calendar)
 
+(defcustom diary-sabbath-candles-minutes 18
+  "Number of minutes before sunset for sabbath candle lighting."
+  :group 'diary
+  :type 'integer
+  :version "21.1")
+
+
+;;; End of user options.
+
+
 (defvar solar-n-hemi-seasons
   '("Vernal Equinox" "Summer Solstice" "Autumnal Equinox" "Winter Solstice")
   "List of season changes for the northern hemisphere.")
@@ -202,21 +189,43 @@
   "Non-nil if northern spring or summer and nil otherwise.
 Needed for polar areas, in order to know whether the day lasts 0 or 24 hours.")
 
+
+(defsubst calendar-latitude ()
+  "Convert calendar-latitude to a signed decimal fraction, if needed."
+  (if (numberp calendar-latitude)
+      calendar-latitude
+    (let ((lat (+ (aref calendar-latitude 0)
+                  (/ (aref calendar-latitude 1) 60.0))))
+      (if (equal (aref calendar-latitude 2) 'north)
+          lat
+        (- lat)))))
+
+(defsubst calendar-longitude ()
+  "Convert calendar-longitude to a signed decimal fraction, if needed."
+  (if (numberp calendar-longitude)
+      calendar-longitude
+    (let ((long (+ (aref calendar-longitude 0)
+                  (/ (aref calendar-longitude 1) 60.0))))
+      (if (equal (aref calendar-longitude 2) 'east)
+          long
+        (- long)))))
+
 (defun solar-setup ()
   "Prompt user for latitude, longitude, and time zone."
   (beep)
-  (if (not calendar-longitude)
+  (or calendar-longitude
       (setq calendar-longitude
             (solar-get-number
              "Enter longitude (decimal fraction; + east, - west): ")))
-  (if (not calendar-latitude)
+  (or calendar-latitude
       (setq calendar-latitude
             (solar-get-number
              "Enter latitude (decimal fraction; + north, - south): ")))
-  (if (not calendar-time-zone)
+  (or calendar-time-zone
       (setq calendar-time-zone
             (solar-get-number
-             "Enter difference from Coordinated Universal Time (in minutes): 
"))))
+             "Enter difference from Coordinated Universal Time (in \
+minutes): "))))
 
 (defun solar-get-number (prompt)
   "Return a number from the minibuffer, prompting with PROMPT.
@@ -225,20 +234,14 @@
     (if (not (string-equal x ""))
         (string-to-number x))))
 
-;; The condition-case stuff is needed to catch bogus arithmetic
-;; exceptions that occur on some machines (like Sparcs)
 (defun solar-sin-degrees (x)
-  (condition-case nil
-      (sin (degrees-to-radians (mod x 360.0)))
-    (solar-sin-degrees x)))
+  (sin (degrees-to-radians (mod x 360.0))))
+
 (defun solar-cosine-degrees (x)
-   (condition-case nil
-       (cos (degrees-to-radians (mod x 360.0)))
-     (solar-cosine-degrees x)))
+  (cos (degrees-to-radians (mod x 360.0))))
+
 (defun solar-tangent-degrees (x)
-  (condition-case nil
-      (tan (degrees-to-radians (mod x 360.0)))
-    (solar-tangent-degrees x)))
+  (tan (degrees-to-radians (mod x 360.0))))
 
 (defun solar-xy-to-quadrant (x y)
   "Determines the quadrant of the point X, Y."
@@ -260,7 +263,7 @@
 
 (defun solar-atn2 (x y)
    "Arctan of point X, Y."
-   (if (= x 0)
+   (if (zerop x)
        (if (> y 0) 90 270)
      (solar-arctan (/ y x) (solar-xy-to-quadrant x y))))
 
@@ -272,8 +275,7 @@
 (defun solar-arcsin (y)
      "Arcsin of Y."
      (let ((x (sqrt (- 1 (* y y)))))
-       (solar-atn2 x y)
-       ))
+    (solar-atn2 x y)))
 
 (defsubst solar-degrees-to-hours (degrees)
   "Convert DEGREES to hours."
@@ -914,12 +916,6 @@
       (solar-setup))
   (solar-sunrise-sunset-string date))
 
-(defcustom diary-sabbath-candles-minutes 18
-  "*Number of minutes before sunset for sabbath candle lighting."
-  :group 'diary
-  :type 'integer
-  :version "21.1")
-
 (defun diary-sabbath-candles (&optional mark)
   "Local time of candle lighting diary entry--applies if date is a Friday.
 No diary entry if there is no sunset on that date.
@@ -1044,9 +1040,8 @@
                                    (* -0.00823 z z z)
                                    (* 0.00032 z z z z)))))))
 
-;;;###autoload
 (defun solar-equinoxes-solstices ()
-  "*local* date and time of equinoxes and solstices, if visible in the 
calendar window.
+  "Local date and time of equinoxes and solstices, if visible in the calendar.
 Requires floating point."
   (let ((m displayed-month)
         (y displayed-year))




reply via email to

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