From: Paul Eggert <eggert@cs.ucla.edu>
To: "N. Jackson" <nljlistbox2@gmail.com>
Cc: 24291@debbugs.gnu.org
Subject: bug#24291: display-time-world seems to ignore zoneinfo-style-world-list when display-time-mode is t
Date: Mon, 2 Oct 2017 00:10:09 -0700 [thread overview]
Message-ID: <3bbf5f86-6506-f8aa-e5c6-97a553ee5352@cs.ucla.edu> (raw)
In-Reply-To: <87a8g3snz6.fsf@moondust.awandering>
[-- Attachment #1: Type: text/plain, Size: 171 bytes --]
This seems to be a clear bug in time.el, as a customizable variable's initial
value should not depend on that of another customizable variable. Proposed patch
attached.
[-- Attachment #2: 0001-Fix-customization-of-zoneinfo-style-world-list.patch --]
[-- Type: text/x-patch, Size: 3664 bytes --]
From 59ad540379c79271c373c1556d38f67aa13944e6 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@day>
Date: Mon, 2 Oct 2017 00:05:47 -0700
Subject: [PATCH] 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 @@ legacy-style-world-list
: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 @@ display-time-world
(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 @@ display-time-world
(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
--
2.7.4
next prev parent reply other threads:[~2017-10-02 7:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-23 11:50 bug#24291: 25.1; display-time-world seems to ignore zoneinfo-style-world-list when display-time-mode is t N. Jackson
2016-08-23 14:43 ` Eli Zaretskii
2016-08-23 19:39 ` N. Jackson
2016-08-24 2:38 ` Eli Zaretskii
2016-08-24 5:40 ` Glenn Morris
2016-08-24 21:03 ` N. Jackson
2016-08-25 2:40 ` Eli Zaretskii
2017-10-02 7:10 ` Paul Eggert [this message]
2017-10-02 16:00 ` bug#24291: " Eli Zaretskii
2017-10-02 16:08 ` Paul Eggert
2017-10-02 17:00 ` N. Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3bbf5f86-6506-f8aa-e5c6-97a553ee5352@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=24291@debbugs.gnu.org \
--cc=nljlistbox2@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.