From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs 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 Organization: UCLA Computer Science Department Message-ID: <3bbf5f86-6506-f8aa-e5c6-97a553ee5352@cs.ucla.edu> References: <87a8g3snz6.fsf@moondust.awandering> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------A42FA5460D4EC6D7A1F9264D" X-Trace: blaine.gmane.org 1506928279 21368 195.159.176.226 (2 Oct 2017 07:11:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 2 Oct 2017 07:11:19 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 Cc: 24291@debbugs.gnu.org To: "N. Jackson" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 02 09:11:13 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dyush-0004Xc-2W for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Oct 2017 09:11:11 +0200 Original-Received: from localhost ([::1]:50963 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dyusl-0003x0-6o for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Oct 2017 03:11:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49159) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dyuse-0003wt-Ib for bug-gnu-emacs@gnu.org; Mon, 02 Oct 2017 03:11:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dyusY-0001k9-LN for bug-gnu-emacs@gnu.org; Mon, 02 Oct 2017 03:11:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34696) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dyusY-0001jy-Gf for bug-gnu-emacs@gnu.org; Mon, 02 Oct 2017 03:11:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dyusY-000105-0v for bug-gnu-emacs@gnu.org; Mon, 02 Oct 2017 03:11:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <87a8g3snz6.fsf@moondust.awandering> Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Oct 2017 07:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24291 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24291-submit@debbugs.gnu.org id=B24291.15069282183775 (code B ref 24291); Mon, 02 Oct 2017 07:11:01 +0000 Original-Received: (at 24291) by debbugs.gnu.org; 2 Oct 2017 07:10:18 +0000 Original-Received: from localhost ([127.0.0.1]:43377 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dyurq-0000yp-4j for submit@debbugs.gnu.org; Mon, 02 Oct 2017 03:10:18 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:49840) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dyuro-0000ya-AJ for 24291@debbugs.gnu.org; Mon, 02 Oct 2017 03:10:16 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id B9A8416022A; Mon, 2 Oct 2017 00:10:10 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id vB6ndsLIhtMc; Mon, 2 Oct 2017 00:10:09 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id B764B160D8D; Mon, 2 Oct 2017 00:10:09 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id yQe_FEpTochw; Mon, 2 Oct 2017 00:10:09 -0700 (PDT) Original-Received: from [192.168.1.9] (unknown [47.154.18.85]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 94ACC16022A; Mon, 2 Oct 2017 00:10:09 -0700 (PDT) Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:137769 Archived-At: This is a multi-part message in MIME format. --------------A42FA5460D4EC6D7A1F9264D Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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. --------------A42FA5460D4EC6D7A1F9264D Content-Type: text/x-patch; name="0001-Fix-customization-of-zoneinfo-style-world-list.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Fix-customization-of-zoneinfo-style-world-list.patch" >From 59ad540379c79271c373c1556d38f67aa13944e6 Mon Sep 17 00:00:00 2001 From: Paul Eggert 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 --------------A42FA5460D4EC6D7A1F9264D--