Use find-file-hook instead of find-file-hooks.
[bpt/emacs.git] / lisp / time.el
index 8bc1497..f451529 100644 (file)
@@ -1,7 +1,7 @@
 ;;; time.el --- display time, load and mail indicator in mode line of Emacs -*-coding: utf-8 -*-
 
 ;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1996, 2000, 2001, 2002,
-;;   2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+;;   2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 
@@ -112,22 +112,66 @@ A value of nil means 1 <= hh <= 12, and an AM/PM suffix is used."
    "Time when mail file's file system was recorded to be down.
 If that file system seems to be up, the value is nil.")
 
-(defcustom display-time-world-list
+(defcustom zoneinfo-style-world-list
   '(("America/Los_Angeles" "Seattle")
     ("America/New_York" "New York")
     ("Europe/London" "London")
     ("Europe/Paris" "Paris")
     ("Asia/Calcutta" "Bangalore")
     ("Asia/Tokyo" "Tokyo"))
-  "Alist specifying time zones and places for `display-time-world'.
+  "Alist of zoneinfo-style time zones and places for `display-time-world'.
+Each element has the form (TIMEZONE LABEL).
+TIMEZONE should be a string of the form AREA/LOCATION, where AREA is
+the name of a region -- a continent or ocean, and LOCATION is the name
+of a specific location, e.g., a city, within that region.
+LABEL is a string to display as the label of that TIMEZONE's time."
+  :group 'display-time
+  :type '(repeat (list string string))
+  :version "23.1")
+
+(defcustom legacy-style-world-list
+  '(("PST8PDT" "Seattle")
+    ("EST5EDT" "New York")
+    ("GMT0BST" "London")
+    ("CET-1CDT" "Paris")
+    ("IST-5:30" "Bangalore")
+    ("JST-9" "Tokyo"))
+  "Alist of traditional-style time zones and places for `display-time-world'.
+Each element has the form (TIMEZONE LABEL).
+TIMEZONE should be a string of the form:
+
+     std[+|-]offset[dst[offset][,date[/time],date[/time]]]
+
+See the documentation of the TZ environment variable on your system,
+for more details about the format of TIMEZONE.
+LABEL is a string to display as the label of that TIMEZONE's time."
+  :group 'display-time
+  :type '(repeat (list string string))
+  :version "23.1")
+
+(defcustom display-time-world-list
+  ;; Determine if zoneinfo style timezones are supported by testing that
+  ;; America/New York and Europe/London return different timezones.
+  (let (gmt nyt)
+    (set-time-zone-rule "America/New York")
+    (setq nyt (format-time-string "%z"))
+    (set-time-zone-rule "Europe/London")
+    (setq gmt (format-time-string "%z"))
+    (set-time-zone-rule nil)
+    (if (string-equal nyt gmt)
+        legacy-style-world-list
+      zoneinfo-style-world-list))
+  "Alist of time zones and places for `display-time-world' to display.
 Each element has the form (TIMEZONE LABEL).
-TIMEZONE should be a valid argument for `set-time-zone-rule'.
-LABEL is a string to display to label that zone's time."
+TIMEZONE should be in the format supported by `set-time-zone-rule' on
+your system.  See the documentation of `zoneinfo-style-world-list' and
+\`legacy-style-world-list' for two widely used formats.
+LABEL is a string to display as the label of that TIMEZONE's time."
   :group 'display-time
   :type '(repeat (list string string))
   :version "23.1")
 
-(defcustom display-time-world-time-format "%A %m %B %R %Z"
+(defcustom display-time-world-time-format "%A %d %B %R %Z"
   "Format of the time displayed, see `format-time-string'."
   :group 'display-time
   :type 'string