diff options
| -rw-r--r-- | lisp/ChangeLog | 61 | ||||
| -rw-r--r-- | lisp/calendar/solar.el | 117 |
2 files changed, 117 insertions, 61 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cb1d44dd9de..cefab268ec9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -16,6 +16,67 @@ | |||
| 16 | 16 | ||
| 17 | 2008-03-07 Glenn Morris <rgm@gnu.org> | 17 | 2008-03-07 Glenn Morris <rgm@gnu.org> |
| 18 | 18 | ||
| 19 | * calendar/appt.el (appt-issue-message) | ||
| 20 | (appt-message-warning-time, appt-audible, appt-visible) | ||
| 21 | (appt-msg-window, appt-display-mode-line, appt-display-duration) | ||
| 22 | (appt-display-diary): Remove autoload cookies. | ||
| 23 | |||
| 24 | * calendar/cal-china.el, calendar/timeclock.el, calendar/todo-mode.el: | ||
| 25 | Remove leading `*' from defcustom doc-strings. | ||
| 26 | |||
| 27 | * calendar/cal-dst.el (calendar-dst): New custom group. | ||
| 28 | (calendar-daylight-savings-starts, calendar-daylight-savings-ends) | ||
| 29 | (calendar-time-zone, calendar-daylight-time-offset) | ||
| 30 | (calendar-standard-time-zone-name, calendar-daylight-time-zone-name) | ||
| 31 | (calendar-daylight-savings-starts-time) | ||
| 32 | (calendar-daylight-savings-ends-time): Convert from defvar to defcustom. | ||
| 33 | (calendar-daylight-savings-starts, calendar-daylight-savings-ends): | ||
| 34 | Move to start. | ||
| 35 | |||
| 36 | * calendar/cal-menu.el (holidays-in-diary-buffer): Declare for compiler. | ||
| 37 | |||
| 38 | * calendar/calendar.el (calendar-version): Use emacs-version and | ||
| 39 | make it obsolete. Move to end. | ||
| 40 | (calendar-offset, view-diary-entries-initially) | ||
| 41 | (mark-diary-entries-in-calendar, calendar-remove-frame-by-deleting) | ||
| 42 | (view-calendar-holidays-initially, all-hebrew-calendar-holidays) | ||
| 43 | (all-christian-calendar-holidays, all-islamic-calendar-holidays) | ||
| 44 | (all-bahai-calendar-holidays, calendar-load-hook) | ||
| 45 | (initial-calendar-window-hook, today-visible-calendar-hook) | ||
| 46 | (today-invisible-calendar-hook, calendar-move-hook) | ||
| 47 | (diary-nonmarking-symbol, hebrew-diary-entry-symbol) | ||
| 48 | (islamic-diary-entry-symbol, bahai-diary-entry-symbol) | ||
| 49 | (diary-include-string, sexp-diary-entry-symbol) | ||
| 50 | (abbreviated-calendar-year, american-date-diary-pattern) | ||
| 51 | (european-date-diary-pattern, european-calendar-display-form) | ||
| 52 | (american-calendar-display-form, print-diary-entries-hook) | ||
| 53 | (list-diary-entries-hook, diary-hook, diary-display-hook) | ||
| 54 | (nongregorian-diary-listing-hook, mark-diary-entries-hook) | ||
| 55 | (nongregorian-diary-marking-hook, diary-list-include-blanks) | ||
| 56 | (holidays-in-diary-buffer, general-holidays, oriental-holidays) | ||
| 57 | (local-holidays, other-holidays, hebrew-holidays-1) | ||
| 58 | (hebrew-holidays-2, hebrew-holidays-3, hebrew-holidays-4) | ||
| 59 | (hebrew-holidays, christian-holidays, islamic-holidays) | ||
| 60 | (bahai-holidays, solar-holidays, calendar-setup) | ||
| 61 | (calendar-week-start-day): Remove autoload cookies. | ||
| 62 | (diary-glob-file-regexp-prefix): Doc fix. | ||
| 63 | (calendar-goto-info-node): Use `info' rather than `Info-find-node'. | ||
| 64 | (Info-find-emacs-command-nodes, Info-find-node): Remove declarations. | ||
| 65 | (calendar-week-start-day, calendar-debug-sexp): Move to start. | ||
| 66 | |||
| 67 | * calendar/solar.el: Remove leading `*' from defcustom doc-strings. | ||
| 68 | (calendar-time-display-form, calendar-latitude) | ||
| 69 | (calendar-longitude, solar-equinoxes-solstices): Remove autoload | ||
| 70 | cookies. | ||
| 71 | (calendar-latitude, calendar-longitude): Move functions after | ||
| 72 | variables. | ||
| 73 | (diary-sabbath-candles-minutes): Move to start. | ||
| 74 | (solar-setup): Use or rather than if. | ||
| 75 | (solar-sin-degrees, solar-cosine-degrees, solar-tangent-degrees): | ||
| 76 | Remove condition-case. | ||
| 77 | (solar-atn2): Use zerop. | ||
| 78 | (solar-equinoxes-solstices): Doc fix. | ||
| 79 | |||
| 19 | * mail/supercite.el: Remove leading `*' from defcustom doc-strings. | 80 | * mail/supercite.el: Remove leading `*' from defcustom doc-strings. |
| 20 | (sc-mode-map-prefix): Doc fix. Make it a defcustom. | 81 | (sc-mode-map-prefix): Doc fix. Make it a defcustom. |
| 21 | 82 | ||
diff --git a/lisp/calendar/solar.el b/lisp/calendar/solar.el index a08aa8e64ec..31d331163e6 100644 --- a/lisp/calendar/solar.el +++ b/lisp/calendar/solar.el | |||
| @@ -61,16 +61,16 @@ | |||
| 61 | 61 | ||
| 62 | (if (fboundp 'atan) | 62 | (if (fboundp 'atan) |
| 63 | (require 'lisp-float-type) | 63 | (require 'lisp-float-type) |
| 64 | (error "Solar/lunar calculations impossible since floating point is unavailable")) | 64 | (error "Solar calculations impossible since floating point is unavailable")) |
| 65 | 65 | ||
| 66 | (require 'cal-dst) | 66 | (require 'cal-dst) |
| 67 | (require 'cal-julian) | 67 | (require 'cal-julian) |
| 68 | 68 | ||
| 69 | ;;;###autoload | 69 | |
| 70 | (defcustom calendar-time-display-form | 70 | (defcustom calendar-time-display-form |
| 71 | '(12-hours ":" minutes am-pm | 71 | '(12-hours ":" minutes am-pm |
| 72 | (if time-zone " (") time-zone (if time-zone ")")) | 72 | (if time-zone " (") time-zone (if time-zone ")")) |
| 73 | "*The pseudo-pattern that governs the way a time of day is formatted. | 73 | "The pseudo-pattern that governs the way a time of day is formatted. |
| 74 | 74 | ||
| 75 | A pseudo-pattern is a list of expressions that can involve the keywords | 75 | A pseudo-pattern is a list of expressions that can involve the keywords |
| 76 | `12-hours', `24-hours', and `minutes', all numbers in string form, | 76 | `12-hours', `24-hours', and `minutes', all numbers in string form, |
| @@ -85,9 +85,8 @@ would give military-style times like `21:07 (UTC)'." | |||
| 85 | :type 'sexp | 85 | :type 'sexp |
| 86 | :group 'calendar) | 86 | :group 'calendar) |
| 87 | 87 | ||
| 88 | ;;;###autoload | ||
| 89 | (defcustom calendar-latitude nil | 88 | (defcustom calendar-latitude nil |
| 90 | "*Latitude of `calendar-location-name' in degrees. | 89 | "Latitude of `calendar-location-name' in degrees. |
| 91 | 90 | ||
| 92 | The value can be either a decimal fraction (one place of accuracy is | 91 | The value can be either a decimal fraction (one place of accuracy is |
| 93 | sufficient), + north, - south, such as 40.7 for New York City, or the value | 92 | sufficient), + north, - south, such as 40.7 for New York City, or the value |
| @@ -105,9 +104,8 @@ This variable should be set in `site-start'.el." | |||
| 105 | (const south)))) | 104 | (const south)))) |
| 106 | :group 'calendar) | 105 | :group 'calendar) |
| 107 | 106 | ||
| 108 | ;;;###autoload | ||
| 109 | (defcustom calendar-longitude nil | 107 | (defcustom calendar-longitude nil |
| 110 | "*Longitude of `calendar-location-name' in degrees. | 108 | "Longitude of `calendar-location-name' in degrees. |
| 111 | 109 | ||
| 112 | The value can be either a decimal fraction (one place of accuracy is | 110 | The value can be either a decimal fraction (one place of accuracy is |
| 113 | sufficient), + east, - west, such as -73.9 for New York City, or the value | 111 | sufficient), + east, - west, such as -73.9 for New York City, or the value |
| @@ -125,27 +123,6 @@ This variable should be set in `site-start'.el." | |||
| 125 | (const west)))) | 123 | (const west)))) |
| 126 | :group 'calendar) | 124 | :group 'calendar) |
| 127 | 125 | ||
| 128 | (defsubst calendar-latitude () | ||
| 129 | "Convert calendar-latitude to a signed decimal fraction, if needed." | ||
| 130 | (if (numberp calendar-latitude) | ||
| 131 | calendar-latitude | ||
| 132 | (let ((lat (+ (aref calendar-latitude 0) | ||
| 133 | (/ (aref calendar-latitude 1) 60.0)))) | ||
| 134 | (if (equal (aref calendar-latitude 2) 'north) | ||
| 135 | lat | ||
| 136 | (- lat))))) | ||
| 137 | |||
| 138 | (defsubst calendar-longitude () | ||
| 139 | "Convert calendar-longitude to a signed decimal fraction, if needed." | ||
| 140 | (if (numberp calendar-longitude) | ||
| 141 | calendar-longitude | ||
| 142 | (let ((long (+ (aref calendar-longitude 0) | ||
| 143 | (/ (aref calendar-longitude 1) 60.0)))) | ||
| 144 | (if (equal (aref calendar-longitude 2) 'east) | ||
| 145 | long | ||
| 146 | (- long))))) | ||
| 147 | |||
| 148 | ;;;###autoload | ||
| 149 | (defcustom calendar-location-name | 126 | (defcustom calendar-location-name |
| 150 | '(let ((float-output-format "%.1f")) | 127 | '(let ((float-output-format "%.1f")) |
| 151 | (format "%s%s, %s%s" | 128 | (format "%s%s, %s%s" |
| @@ -163,7 +140,7 @@ This variable should be set in `site-start'.el." | |||
| 163 | (if (numberp calendar-longitude) | 140 | (if (numberp calendar-longitude) |
| 164 | (if (> calendar-longitude 0) "E" "W") | 141 | (if (> calendar-longitude 0) "E" "W") |
| 165 | (if (equal (aref calendar-longitude 2) 'east) "E" "W")))) | 142 | (if (equal (aref calendar-longitude 2) 'east) "E" "W")))) |
| 166 | "*Expression evaluating to name of `calendar-longitude', `calendar-latitude'. | 143 | "Expression evaluating to name of `calendar-longitude', `calendar-latitude'. |
| 167 | For example, \"New York City\". Default value is just the latitude, longitude | 144 | For example, \"New York City\". Default value is just the latitude, longitude |
| 168 | pair. | 145 | pair. |
| 169 | 146 | ||
| @@ -172,7 +149,7 @@ This variable should be set in `site-start'.el." | |||
| 172 | :group 'calendar) | 149 | :group 'calendar) |
| 173 | 150 | ||
| 174 | (defcustom solar-error 0.5 | 151 | (defcustom solar-error 0.5 |
| 175 | "*Tolerance (in minutes) for sunrise/sunset calculations. | 152 | "Tolerance (in minutes) for sunrise/sunset calculations. |
| 176 | 153 | ||
| 177 | A larger value makes the calculations for sunrise/sunset faster, but less | 154 | A larger value makes the calculations for sunrise/sunset faster, but less |
| 178 | accurate. The default is half a minute (30 seconds), so that sunrise/sunset | 155 | accurate. The default is half a minute (30 seconds), so that sunrise/sunset |
| @@ -186,6 +163,16 @@ delta. At present, delta = 0.01 degrees, so the value of the variable | |||
| 186 | :type 'number | 163 | :type 'number |
| 187 | :group 'calendar) | 164 | :group 'calendar) |
| 188 | 165 | ||
| 166 | (defcustom diary-sabbath-candles-minutes 18 | ||
| 167 | "Number of minutes before sunset for sabbath candle lighting." | ||
| 168 | :group 'diary | ||
| 169 | :type 'integer | ||
| 170 | :version "21.1") | ||
| 171 | |||
| 172 | |||
| 173 | ;;; End of user options. | ||
| 174 | |||
| 175 | |||
| 189 | (defvar solar-n-hemi-seasons | 176 | (defvar solar-n-hemi-seasons |
| 190 | '("Vernal Equinox" "Summer Solstice" "Autumnal Equinox" "Winter Solstice") | 177 | '("Vernal Equinox" "Summer Solstice" "Autumnal Equinox" "Winter Solstice") |
| 191 | "List of season changes for the northern hemisphere.") | 178 | "List of season changes for the northern hemisphere.") |
| @@ -202,21 +189,43 @@ delta. At present, delta = 0.01 degrees, so the value of the variable | |||
| 202 | "Non-nil if northern spring or summer and nil otherwise. | 189 | "Non-nil if northern spring or summer and nil otherwise. |
| 203 | Needed for polar areas, in order to know whether the day lasts 0 or 24 hours.") | 190 | Needed for polar areas, in order to know whether the day lasts 0 or 24 hours.") |
| 204 | 191 | ||
| 192 | |||
| 193 | (defsubst calendar-latitude () | ||
| 194 | "Convert calendar-latitude to a signed decimal fraction, if needed." | ||
| 195 | (if (numberp calendar-latitude) | ||
| 196 | calendar-latitude | ||
| 197 | (let ((lat (+ (aref calendar-latitude 0) | ||
| 198 | (/ (aref calendar-latitude 1) 60.0)))) | ||
| 199 | (if (equal (aref calendar-latitude 2) 'north) | ||
| 200 | lat | ||
| 201 | (- lat))))) | ||
| 202 | |||
| 203 | (defsubst calendar-longitude () | ||
| 204 | "Convert calendar-longitude to a signed decimal fraction, if needed." | ||
| 205 | (if (numberp calendar-longitude) | ||
| 206 | calendar-longitude | ||
| 207 | (let ((long (+ (aref calendar-longitude 0) | ||
| 208 | (/ (aref calendar-longitude 1) 60.0)))) | ||
| 209 | (if (equal (aref calendar-longitude 2) 'east) | ||
| 210 | long | ||
| 211 | (- long))))) | ||
| 212 | |||
| 205 | (defun solar-setup () | 213 | (defun solar-setup () |
| 206 | "Prompt user for latitude, longitude, and time zone." | 214 | "Prompt user for latitude, longitude, and time zone." |
| 207 | (beep) | 215 | (beep) |
| 208 | (if (not calendar-longitude) | 216 | (or calendar-longitude |
| 209 | (setq calendar-longitude | 217 | (setq calendar-longitude |
| 210 | (solar-get-number | 218 | (solar-get-number |
| 211 | "Enter longitude (decimal fraction; + east, - west): "))) | 219 | "Enter longitude (decimal fraction; + east, - west): "))) |
| 212 | (if (not calendar-latitude) | 220 | (or calendar-latitude |
| 213 | (setq calendar-latitude | 221 | (setq calendar-latitude |
| 214 | (solar-get-number | 222 | (solar-get-number |
| 215 | "Enter latitude (decimal fraction; + north, - south): "))) | 223 | "Enter latitude (decimal fraction; + north, - south): "))) |
| 216 | (if (not calendar-time-zone) | 224 | (or calendar-time-zone |
| 217 | (setq calendar-time-zone | 225 | (setq calendar-time-zone |
| 218 | (solar-get-number | 226 | (solar-get-number |
| 219 | "Enter difference from Coordinated Universal Time (in minutes): ")))) | 227 | "Enter difference from Coordinated Universal Time (in \ |
| 228 | minutes): ")))) | ||
| 220 | 229 | ||
| 221 | (defun solar-get-number (prompt) | 230 | (defun solar-get-number (prompt) |
| 222 | "Return a number from the minibuffer, prompting with PROMPT. | 231 | "Return a number from the minibuffer, prompting with PROMPT. |
| @@ -225,20 +234,14 @@ Returns nil if nothing was entered." | |||
| 225 | (if (not (string-equal x "")) | 234 | (if (not (string-equal x "")) |
| 226 | (string-to-number x)))) | 235 | (string-to-number x)))) |
| 227 | 236 | ||
| 228 | ;; The condition-case stuff is needed to catch bogus arithmetic | ||
| 229 | ;; exceptions that occur on some machines (like Sparcs) | ||
| 230 | (defun solar-sin-degrees (x) | 237 | (defun solar-sin-degrees (x) |
| 231 | (condition-case nil | 238 | (sin (degrees-to-radians (mod x 360.0)))) |
| 232 | (sin (degrees-to-radians (mod x 360.0))) | 239 | |
| 233 | (solar-sin-degrees x))) | ||
| 234 | (defun solar-cosine-degrees (x) | 240 | (defun solar-cosine-degrees (x) |
| 235 | (condition-case nil | 241 | (cos (degrees-to-radians (mod x 360.0)))) |
| 236 | (cos (degrees-to-radians (mod x 360.0))) | 242 | |
| 237 | (solar-cosine-degrees x))) | ||
| 238 | (defun solar-tangent-degrees (x) | 243 | (defun solar-tangent-degrees (x) |
| 239 | (condition-case nil | 244 | (tan (degrees-to-radians (mod x 360.0)))) |
| 240 | (tan (degrees-to-radians (mod x 360.0))) | ||
| 241 | (solar-tangent-degrees x))) | ||
| 242 | 245 | ||
| 243 | (defun solar-xy-to-quadrant (x y) | 246 | (defun solar-xy-to-quadrant (x y) |
| 244 | "Determines the quadrant of the point X, Y." | 247 | "Determines the quadrant of the point X, Y." |
| @@ -260,20 +263,19 @@ Returns nil if nothing was entered." | |||
| 260 | 263 | ||
| 261 | (defun solar-atn2 (x y) | 264 | (defun solar-atn2 (x y) |
| 262 | "Arctan of point X, Y." | 265 | "Arctan of point X, Y." |
| 263 | (if (= x 0) | 266 | (if (zerop x) |
| 264 | (if (> y 0) 90 270) | 267 | (if (> y 0) 90 270) |
| 265 | (solar-arctan (/ y x) (solar-xy-to-quadrant x y)))) | 268 | (solar-arctan (/ y x) (solar-xy-to-quadrant x y)))) |
| 266 | 269 | ||
| 267 | (defun solar-arccos (x) | 270 | (defun solar-arccos (x) |
| 268 | "Arcos of X." | 271 | "Arcos of X." |
| 269 | (let ((y (sqrt (- 1 (* x x))))) | 272 | (let ((y (sqrt (- 1 (* x x))))) |
| 270 | (solar-atn2 x y))) | 273 | (solar-atn2 x y))) |
| 271 | 274 | ||
| 272 | (defun solar-arcsin (y) | 275 | (defun solar-arcsin (y) |
| 273 | "Arcsin of Y." | 276 | "Arcsin of Y." |
| 274 | (let ((x (sqrt (- 1 (* y y))))) | 277 | (let ((x (sqrt (- 1 (* y y))))) |
| 275 | (solar-atn2 x y) | 278 | (solar-atn2 x y))) |
| 276 | )) | ||
| 277 | 279 | ||
| 278 | (defsubst solar-degrees-to-hours (degrees) | 280 | (defsubst solar-degrees-to-hours (degrees) |
| 279 | "Convert DEGREES to hours." | 281 | "Convert DEGREES to hours." |
| @@ -914,12 +916,6 @@ Accurate to a few seconds." | |||
| 914 | (solar-setup)) | 916 | (solar-setup)) |
| 915 | (solar-sunrise-sunset-string date)) | 917 | (solar-sunrise-sunset-string date)) |
| 916 | 918 | ||
| 917 | (defcustom diary-sabbath-candles-minutes 18 | ||
| 918 | "*Number of minutes before sunset for sabbath candle lighting." | ||
| 919 | :group 'diary | ||
| 920 | :type 'integer | ||
| 921 | :version "21.1") | ||
| 922 | |||
| 923 | (defun diary-sabbath-candles (&optional mark) | 919 | (defun diary-sabbath-candles (&optional mark) |
| 924 | "Local time of candle lighting diary entry--applies if date is a Friday. | 920 | "Local time of candle lighting diary entry--applies if date is a Friday. |
| 925 | No diary entry if there is no sunset on that date. | 921 | No diary entry if there is no sunset on that date. |
| @@ -1044,9 +1040,8 @@ solstice. These formulas are only to be used between 1000 BC and 3000 AD." | |||
| 1044 | (* -0.00823 z z z) | 1040 | (* -0.00823 z z z) |
| 1045 | (* 0.00032 z z z z))))))) | 1041 | (* 0.00032 z z z z))))))) |
| 1046 | 1042 | ||
| 1047 | ;;;###autoload | ||
| 1048 | (defun solar-equinoxes-solstices () | 1043 | (defun solar-equinoxes-solstices () |
| 1049 | "*local* date and time of equinoxes and solstices, if visible in the calendar window. | 1044 | "Local date and time of equinoxes and solstices, if visible in the calendar. |
| 1050 | Requires floating point." | 1045 | Requires floating point." |
| 1051 | (let ((m displayed-month) | 1046 | (let ((m displayed-month) |
| 1052 | (y displayed-year)) | 1047 | (y displayed-year)) |