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#28476: 26.0.60; Gnus: broken timezone in citation line Date: Sun, 17 Sep 2017 20:56:05 -0700 Organization: UCLA Computer Science Department Message-ID: References: <20972.1505625258@alto> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------9FB019246B37EDE0BFDF2CE0" X-Trace: blaine.gmane.org 1505707153 7753 195.159.176.226 (18 Sep 2017 03:59:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 18 Sep 2017 03:59:13 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 Cc: 28476@debbugs.gnu.org To: Mike Kupfer Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Sep 18 05:59:04 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 1dtnD6-0001dm-FW for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Sep 2017 05:59:04 +0200 Original-Received: from localhost ([::1]:34540 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dtnDD-0004yL-JF for geb-bug-gnu-emacs@m.gmane.org; Sun, 17 Sep 2017 23:59:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dtnD7-0004y6-Pq for bug-gnu-emacs@gnu.org; Sun, 17 Sep 2017 23:59:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dtnD4-0007r4-NW for bug-gnu-emacs@gnu.org; Sun, 17 Sep 2017 23:59:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36772) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dtnD4-0007qO-Io for bug-gnu-emacs@gnu.org; Sun, 17 Sep 2017 23:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dtnD4-0002X1-6w for bug-gnu-emacs@gnu.org; Sun, 17 Sep 2017 23:59:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <20972.1505625258@alto> Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 18 Sep 2017 03:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28476 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 28476-submit@debbugs.gnu.org id=B28476.15057071059682 (code B ref 28476); Mon, 18 Sep 2017 03:59:02 +0000 Original-Received: (at 28476) by debbugs.gnu.org; 18 Sep 2017 03:58:25 +0000 Original-Received: from localhost ([127.0.0.1]:45453 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dtnCT-0002W6-Iy for submit@debbugs.gnu.org; Sun, 17 Sep 2017 23:58:25 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:52256) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dtnCQ-0002Vr-VQ for 28476@debbugs.gnu.org; Sun, 17 Sep 2017 23:58:23 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id A3131164735; Sun, 17 Sep 2017 20:58:16 -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 smo1GXpnzMgH; Sun, 17 Sep 2017 20:58:15 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id D241B164474; Sun, 17 Sep 2017 20:57:14 -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 CaWbc_PuYujm; Sun, 17 Sep 2017 20:57:14 -0700 (PDT) Original-Received: from [192.168.1.9] (unknown [47.154.18.85]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 461601643C0; Sun, 17 Sep 2017 20:56:06 -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:137044 Archived-At: This is a multi-part message in MIME format. --------------9FB019246B37EDE0BFDF2CE0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Thanks for the bug report. I see two issues here. First, the change in message-citation-line-format'= s=20 treatment of %Z was deliberate. The new treatment (unlike the old one) is= =20 consistent with format-time-string and this consistency simplifies the=20 documentation and code. If backward-compatibility is a significant hassle= we can=20 re-complicate Emacs, but I'm hoping that users can change %Z to %z in the= ir=20 settings and move on. In the meantime I installed the first attached patc= h into=20 the emacs-26 branch so that the documentation matches the new behavior. (= Sorry,=20 I missed that part of the documentation before.) Second, (format-time-string "%Z" nil -25200) returns "+07" where it shoul= d=20 return "-07" since -25200 denotes 7 hours west of UTC. This is due to a b= lunder=20 in my commit fdb1ba144ca61185e6457f092f38f59dd9bbe6a0 dated 2016-04-12 09= :19:11=20 -0700: the %Z code gets the sign wrong on purely-numeric time zones west = of=20 Greenwich. To fix this bug I installed the second attached patch into the= =20 emacs-26 branch. This fix should cause your example to come out as: On 16 September 2017 17:18 -07, Mike Kupfer wrote: which at least gets the sign right. --------------9FB019246B37EDE0BFDF2CE0 Content-Type: text/x-patch; name="0001-message-citation-line-format-Z-is-now-tz-name.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-message-citation-line-format-Z-is-now-tz-name.patch" =46rom 679e05eeb97eae5a32fc67f4673b019c873ebcca Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 17 Sep 2017 17:46:18 -0700 Subject: [PATCH 1/2] message-citation-line-format %Z is now tz name * etc/NEWS: * lisp/gnus/message.el (message-citation-line-format): Fix doc to match new behavior (Bug#28476). --- etc/NEWS | 6 ++++++ lisp/gnus/message.el | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/etc/NEWS b/etc/NEWS index a042ce9..5aa57a7 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -701,6 +701,12 @@ method is an NNTP select method. *** A new command for sorting articles by readedness marks has been added: 'C-c C-s C-m C-m'. =20 ++++ + +*** In message-citation-line-format the %Z format is now the time zone n= ame +instead of the numeric form. The %z format continues to be the +numeric form. The new behavior is compatible with format-time-string. + ** Ibuffer =20 --- diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 690dd28..a9e66ce 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -991,7 +991,6 @@ message-citation-line-format %F The first name if present, e.g.: \"John\", else fall back to the mail address. %L The last name if present, e.g.: \"Doe\". - %Z, %z The time zone in the numeric form, e.g.:\"+0000\". =20 All other format specifiers are passed to `format-time-string' which is called using the date from the article your replying to, but --=20 2.7.4 --------------9FB019246B37EDE0BFDF2CE0 Content-Type: text/x-patch; name="0002-Fix-format-time-string-Z-bug-with-negative-tz.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0002-Fix-format-time-string-Z-bug-with-negative-tz.patch" =46rom 74fbe646c7d735343628979f6e9bb4543f01fe52 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 17 Sep 2017 20:38:12 -0700 Subject: [PATCH 2/2] Fix format-time-string %Z bug with negative tz * src/editfns.c (tzlookup): Fix sign error in %Z when a purely numeric zone is negative (Bug#28746). * test/src/editfns-tests.el (format-time-string-with-zone): Add test for this bug. --- src/editfns.c | 3 ++- test/src/editfns-tests.el | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/editfns.c b/src/editfns.c index b03eb94..2f8b075 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -187,7 +187,8 @@ tzlookup (Lisp_Object zone, bool settz) if (sec !=3D 0) prec +=3D 2, numzone =3D 100 * numzone + sec; } - sprintf (tzbuf, tzbuf_format, prec, numzone, + sprintf (tzbuf, tzbuf_format, prec, + XINT (zone) < 0 ? -numzone : numzone, &"-"[XINT (zone) < 0], hour, min, sec); zone_string =3D tzbuf; } diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el index 1c3fde8..f910afa 100644 --- a/test/src/editfns-tests.el +++ b/test/src/editfns-tests.el @@ -166,6 +166,10 @@ transpose-test-get-byte-positions (should (string-equal (format-time-string format look '(-28800 "PST")) "1972-06-30 15:59:59.999 -0800 (PST)")) + ;; Negative UTC offset, as a Lisp integer. + (should (string-equal + (format-time-string format look -28800) + "1972-06-30 15:59:59.999 -0800 (-08)")) ;; Positive UTC offset that is not an hour multiple, as a string. (should (string-equal (format-time-string format look "IST-5:30") --=20 2.7.4 --------------9FB019246B37EDE0BFDF2CE0--