summaryrefslogtreecommitdiff
path: root/lisp/calendar
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2008-04-05 21:24:15 +0000
committerGlenn Morris <rgm@gnu.org>2008-04-05 21:24:15 +0000
commit87e1e9cdfa80c3a7693ebfd1f131b3414793c7ce (patch)
treed596e016f1bd0bead7fb0bb794437530300f10b3 /lisp/calendar
parent97f35570ad6e237166be67a17b1b29b4f310c914 (diff)
downloademacs-87e1e9cdfa80c3a7693ebfd1f131b3414793c7ce.tar.gz
(diary-hebrew-sabbath-candles-minutes, diary-hebrew-sabbath-candles):
Move here from solar.el and rename. Doc fix. Keep old name as alias. (solar-setup, solar-sunrise-sunset, calendar-latitude) (calendar-longitude, calendar-time-zone): Declare for compiler.
Diffstat (limited to 'lisp/calendar')
-rw-r--r--lisp/calendar/cal-hebrew.el48
1 files changed, 48 insertions, 0 deletions
diff --git a/lisp/calendar/cal-hebrew.el b/lisp/calendar/cal-hebrew.el
index 8374c9b2a8e..f98bb00ff46 100644
--- a/lisp/calendar/cal-hebrew.el
+++ b/lisp/calendar/cal-hebrew.el
@@ -34,6 +34,18 @@
(require 'calendar)
+(defcustom diary-hebrew-sabbath-candles-minutes 18
+ "Number of minutes before sunset for sabbath candle lighting.
+Used by `diary-hebrew-sabbath-candles'."
+ :group 'diary
+ :type 'integer
+ :version "21.1")
+
+(define-obsolete-variable-alias 'diary-sabbath-candles-minutes
+ 'diary-hebrew-sabbath-candles-minutes "23.1")
+
+;; End of user options.
+
(defun calendar-hebrew-leap-year-p (year)
"Non-nil if YEAR is a Hebrew calendar leap year."
(< (% (1+ (* 7 year)) 19) 7))
@@ -1112,6 +1124,42 @@ use when highlighting the day in the calendar."
(define-obsolete-function-alias 'diary-parasha 'diary-hebrew-parasha "23.1")
+
+(declare-function solar-setup "solar" ())
+(declare-function solar-sunrise-sunset "solar" (date))
+(defvar calendar-latitude)
+(defvar calendar-longitude)
+(defvar calendar-time-zone)
+
+
+;; To be called from list-sexp-diary-entries, where DATE is bound.
+;;;###diary-autoload
+(defun diary-hebrew-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. Uses
+`diary-hebrew-sabbath-candles-minutes'.
+
+An optional parameter MARK specifies a face or single-character string to
+use when highlighting the day in the calendar."
+ (require 'solar)
+ (or (and calendar-latitude calendar-longitude calendar-time-zone)
+ (solar-setup))
+ (if (= (% (calendar-absolute-from-gregorian date) 7) 5) ; Friday
+ (let* ((sunset (cadr (solar-sunrise-sunset date)))
+ (light (if sunset
+ (cons (- (car sunset)
+ (/ diary-hebrew-sabbath-candles-minutes 60.0))
+ (cdr sunset)))))
+ (if sunset
+ (cons mark
+ (format "%s Sabbath candle lighting"
+ (apply 'solar-time-string light)))))))
+
+;;;###diary-autoload
+(define-obsolete-function-alias 'diary-sabbath-candles
+ 'diary-hebrew-sabbath-candles "23.1")
+
+
(provide 'cal-hebrew)
;; arch-tag: aaab6718-7712-42ac-a32d-28fe1f944f3c