summaryrefslogtreecommitdiff
path: root/lisp/calendar/cal-dst.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2008-03-07 05:13:00 +0000
committerGlenn Morris <rgm@gnu.org>2008-03-07 05:13:00 +0000
commitec1ee609ae6e8668b3e242ed646d6016368eac4d (patch)
tree1b26416e5ecd01ff6d00f0cde4c1fbd0d17bed8d /lisp/calendar/cal-dst.el
parentc4632735bb2fb1c97aab9847bf0bdda2437b08c0 (diff)
downloademacs-ec1ee609ae6e8668b3e242ed646d6016368eac4d.tar.gz
(calendar-dst): New custom group.
(calendar-daylight-savings-starts, calendar-daylight-savings-ends) (calendar-time-zone, calendar-daylight-time-offset) (calendar-standard-time-zone-name, calendar-daylight-time-zone-name) (calendar-daylight-savings-starts-time) (calendar-daylight-savings-ends-time): Convert from defvar to defcustom. (calendar-daylight-savings-starts, calendar-daylight-savings-ends): Move to start.
Diffstat (limited to 'lisp/calendar/cal-dst.el')
-rw-r--r--lisp/calendar/cal-dst.el156
1 files changed, 88 insertions, 68 deletions
diff --git a/lisp/calendar/cal-dst.el b/lisp/calendar/cal-dst.el
index 4f442c075f0..a6e9aa252ad 100644
--- a/lisp/calendar/cal-dst.el
+++ b/lisp/calendar/cal-dst.el
@@ -36,6 +36,13 @@
(require 'calendar)
(require 'cal-persia)
+
+(defgroup calendar-dst nil
+ "Options related to Daylight Saving Time."
+ :prefix "calendar-"
+ :group 'calendar)
+
+
(defcustom calendar-dst-check-each-year-flag t
"Non-nil means to check each year for DST transitions as needed.
Otherwise assume the next two transitions found after the
@@ -46,9 +53,51 @@ change."
:version "22.1"
:group 'calendar)
+;;;###autoload
+(put 'calendar-daylight-savings-starts 'risky-local-variable t)
+(defcustom calendar-daylight-savings-starts '(calendar-dst-starts year)
+ "Sexp giving the date on which daylight saving time starts.
+This is an expression in the variable `year' whose value gives the Gregorian
+date in the form (month day year) on which daylight saving time starts. It is
+used to determine the starting date of daylight saving time for the holiday
+list and for correcting times of day in the solar and lunar calculations.
+
+For example, if daylight saving time is mandated to start on October 1,
+you would set `calendar-daylight-savings-starts' to
+
+ '(10 1 year)
+
+If it starts on the first Sunday in April, you would set it to
+
+ '(calendar-nth-named-day 1 0 4 year)
+
+If the locale never uses daylight saving time, set this to nil."
+ :type 'sexp
+ :group 'calendar-dst)
+
+;;;###autoload
+(put 'calendar-daylight-savings-ends 'risky-local-variable t)
+(defcustom calendar-daylight-savings-ends '(calendar-dst-ends year)
+ "Sexp giving the date on which daylight saving time ends.
+This is an expression in the variable `year' whose value gives the Gregorian
+date in the form (month day year) on which daylight saving time ends. It is
+used to determine the starting date of daylight saving time for the holiday
+list and for correcting times of day in the solar and lunar calculations.
+
+For example, if daylight saving time ends on the last Sunday in October:
+
+ '(calendar-nth-named-day -1 0 10 year)
+
+If the locale never uses daylight saving time, set this to nil."
+ :type 'sexp
+ :group 'calendar-dst)
+
+;;; More defcustoms below.
+
+
(defvar calendar-current-time-zone-cache nil
"Cache for result of `calendar-current-time-zone'.")
-(put 'calendar-current-time-zone-cache 'risky-local-variable t)
+(put 'calendar-current-time-zone-cache 'risky-local-variable t) ; why?
(defvar calendar-system-time-basis
(calendar-absolute-from-gregorian '(1 1 1970))
@@ -310,35 +359,53 @@ it can't find."
(unless calendar-current-time-zone-cache
(setq calendar-current-time-zone-cache (calendar-dst-find-data))))
-;;; The following eight defvars relating to daylight saving time should NOT be
-;;; marked to go into loaddefs.el where they would be evaluated when Emacs is
-;;; dumped. These variables' appropriate values depend on the conditions under
-;;; which the code is INVOKED; so it's inappropriate to initialize them when
-;;; Emacs is dumped---they should be initialized when calendar.el is loaded.
-;;; They default to US Eastern time if time zone info is not available.
+
+;; Following options should be set based on conditions when the code
+;; is invoked, so are not suitable for dumping into loaddefs.el. They
+;; default to US Eastern time if time zone info is not available.
(calendar-current-time-zone)
-(defvar calendar-time-zone (or (car calendar-current-time-zone-cache) -300)
- "*Number of minutes difference between local standard time at
-`calendar-location-name' and Coordinated Universal (Greenwich) Time. For
-example, -300 for New York City, -480 for Los Angeles.")
+(defcustom calendar-time-zone (or (car calendar-current-time-zone-cache) -300)
+ "Number of minutes difference between local standard time at
+`calendar-location-name' and Coordinated Universal (Greenwich) Time.
+For example, -300 for New York City, -480 for Los Angeles."
+ :type 'integer
+ :group 'calendar-dst)
-(defvar calendar-daylight-time-offset
+(defcustom calendar-daylight-time-offset
(or (car (cdr calendar-current-time-zone-cache)) 60)
- "*Number of minutes difference between daylight saving and standard time.
-
-If the locale never uses daylight saving time, set this to 0.")
+ "Number of minutes difference between daylight saving and standard time.
+If the locale never uses daylight saving time, set this to 0."
+ :type 'integer
+ :group 'calendar-dst)
-(defvar calendar-standard-time-zone-name
+(defcustom calendar-standard-time-zone-name
(or (car (nthcdr 2 calendar-current-time-zone-cache)) "EST")
- "*Abbreviated name of standard time zone at `calendar-location-name'.
-For example, \"EST\" in New York City, \"PST\" for Los Angeles.")
+ "Abbreviated name of standard time zone at `calendar-location-name'.
+For example, \"EST\" in New York City, \"PST\" for Los Angeles."
+ :type 'string
+ :group 'calendar-dst)
-(defvar calendar-daylight-time-zone-name
+(defcustom calendar-daylight-time-zone-name
(or (car (nthcdr 3 calendar-current-time-zone-cache)) "EDT")
- "*Abbreviated name of daylight saving time zone at `calendar-location-name'.
-For example, \"EDT\" in New York City, \"PDT\" for Los Angeles.")
+ "Abbreviated name of daylight saving time zone at `calendar-location-name'.
+For example, \"EDT\" in New York City, \"PDT\" for Los Angeles."
+ :type 'string
+ :group 'calendar-dst)
+
+(defcustom calendar-daylight-savings-starts-time
+ (or (car (nthcdr 6 calendar-current-time-zone-cache)) 120)
+ "Number of minutes after midnight that daylight saving time starts."
+ :type 'integer
+ :group 'calendar-dst)
+
+(defcustom calendar-daylight-savings-ends-time
+ (or (car (nthcdr 7 calendar-current-time-zone-cache))
+ calendar-daylight-savings-starts-time)
+ "Number of minutes after midnight that daylight saving time ends."
+ :type 'integer
+ :group 'calendar-dst)
(defun calendar-dst-starts (year)
@@ -363,53 +430,6 @@ This function respects the value of `calendar-dst-check-each-year-flag'."
(and (not (zerop calendar-daylight-time-offset))
(calendar-nth-named-day 1 0 11 year))))
-
-;;;###autoload
-(put 'calendar-daylight-savings-starts 'risky-local-variable t)
-(defvar calendar-daylight-savings-starts
- '(calendar-dst-starts year)
- "*Sexp giving the date on which daylight saving time starts.
-This is an expression in the variable `year' whose value gives the Gregorian
-date in the form (month day year) on which daylight saving time starts. It is
-used to determine the starting date of daylight saving time for the holiday
-list and for correcting times of day in the solar and lunar calculations.
-
-For example, if daylight saving time is mandated to start on October 1,
-you would set `calendar-daylight-savings-starts' to
-
- '(10 1 year)
-
-If it starts on the first Sunday in April, you would set it to
-
- '(calendar-nth-named-day 1 0 4 year)
-
-If the locale never uses daylight saving time, set this to nil.")
-
-;;;###autoload
-(put 'calendar-daylight-savings-ends 'risky-local-variable t)
-(defvar calendar-daylight-savings-ends
- '(calendar-dst-ends year)
- "*Sexp giving the date on which daylight saving time ends.
-This is an expression in the variable `year' whose value gives the Gregorian
-date in the form (month day year) on which daylight saving time ends. It is
-used to determine the starting date of daylight saving time for the holiday
-list and for correcting times of day in the solar and lunar calculations.
-
-For example, if daylight saving time ends on the last Sunday in October:
-
- '(calendar-nth-named-day -1 0 10 year)
-
-If the locale never uses daylight saving time, set this to nil.")
-
-(defvar calendar-daylight-savings-starts-time
- (or (car (nthcdr 6 calendar-current-time-zone-cache)) 120)
- "*Number of minutes after midnight that daylight saving time starts.")
-
-(defvar calendar-daylight-savings-ends-time
- (or (car (nthcdr 7 calendar-current-time-zone-cache))
- calendar-daylight-savings-starts-time)
- "*Number of minutes after midnight that daylight saving time ends.")
-
(defun dst-in-effect (date)
"True if on absolute DATE daylight saving time is in effect.
Fractional part of DATE is local standard time of day."