emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-26 987f39a: Fix customization of zoneinfo-style-worl


From: Paul Eggert
Subject: [Emacs-diffs] emacs-26 987f39a: Fix customization of zoneinfo-style-world-list
Date: Mon, 2 Oct 2017 12:06:40 -0400 (EDT)

branch: emacs-26
commit 987f39a124af378966dc5832a48599b110bba436
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Fix customization of zoneinfo-style-world-list
    
    A customizable variable's initial value cannot depend on that of
    another customizable variable, since the variables are initialized
    in other than textual order.  Problem reported by N. Jackson
    (Bug#24291).
    * lisp/time.el (display-time-world-list): Default to t,
    a special value that expands to zoneinfo-style-word-list
    if that works, and to legacy-style-word-list otherwise.
    (time--display-world-list): New function.
    (display-time-world, display-time-world-timer): Use it.
---
 lisp/time.el | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/lisp/time.el b/lisp/time.el
index 5c0eac0..c8726a9 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -160,24 +160,33 @@ LABEL is a string to display as the label of that 
TIMEZONE's 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 ((nyt (format-time-string "%z" nil "America/New_York"))
-        (gmt (format-time-string "%z" nil "Europe/London")))
-    (if (string-equal nyt gmt)
-        legacy-style-world-list
-      zoneinfo-style-world-list))
+(defcustom display-time-world-list t
   "Alist of time zones and places for `display-time-world' to display.
 Each element has the form (TIMEZONE LABEL).
 TIMEZONE should be in a format supported by 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."
+a string to display as the label of that TIMEZONE's time.
+
+If the value is t instead of an alist, use the value of
+`zoneinfo-style-world-list' if it works on this platform, and of
+`legacy-style-world-list' otherwise."
+
   :group 'display-time
   :type '(repeat (list string string))
   :version "23.1")
 
+(defun time--display-world-list ()
+  (if (listp display-time-world-list)
+      display-time-world-list
+    ;; Determine if zoneinfo style timezones are supported by testing that
+    ;; America/New York and Europe/London return different timezones.
+    (let ((nyt (format-time-string "%z" nil "America/New_York"))
+         (gmt (format-time-string "%z" nil "Europe/London")))
+      (if (string-equal nyt gmt)
+         legacy-style-world-list
+       zoneinfo-style-world-list))))
+
 (defcustom display-time-world-time-format "%A %d %B %R %Z"
   "Format of the time displayed, see `format-time-string'."
   :group 'display-time
@@ -548,7 +557,7 @@ To turn off the world time display, go to that window and 
type `q'."
              (not (get-buffer display-time-world-buffer-name)))
     (run-at-time t display-time-world-timer-second 'display-time-world-timer))
   (with-current-buffer (get-buffer-create display-time-world-buffer-name)
-    (display-time-world-display display-time-world-list)
+    (display-time-world-display (time--display-world-list))
     (display-buffer display-time-world-buffer-name
                    (cons nil '((window-height . fit-window-to-buffer))))
     (display-time-world-mode)))
@@ -556,7 +565,7 @@ To turn off the world time display, go to that window and 
type `q'."
 (defun display-time-world-timer ()
   (if (get-buffer display-time-world-buffer-name)
       (with-current-buffer (get-buffer display-time-world-buffer-name)
-        (display-time-world-display display-time-world-list))
+        (display-time-world-display (time--display-world-list)))
     ;; cancel timer
     (let ((list timer-list))
       (while list



reply via email to

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