From: Paul Eggert <eggert@cs.ucla.edu>
To: Mike Kupfer <mkupfer@alum.berkeley.edu>
Cc: 28476@debbugs.gnu.org
Subject: bug#28476: 26.0.60; Gnus: broken timezone in citation line
Date: Sun, 17 Sep 2017 20:56:05 -0700 [thread overview]
Message-ID: <d31ba1ed-26e6-6fab-41a8-e94b3a6ffe13@cs.ucla.edu> (raw)
In-Reply-To: <20972.1505625258@alto>
[-- Attachment #1: Type: text/plain, Size: 1193 bytes --]
Thanks for the bug report.
I see two issues here. First, the change in message-citation-line-format's
treatment of %Z was deliberate. The new treatment (unlike the old one) is
consistent with format-time-string and this consistency simplifies the
documentation and code. If backward-compatibility is a significant hassle we can
re-complicate Emacs, but I'm hoping that users can change %Z to %z in their
settings and move on. In the meantime I installed the first attached patch into
the emacs-26 branch so that the documentation matches the new behavior. (Sorry,
I missed that part of the documentation before.)
Second, (format-time-string "%Z" nil -25200) returns "+07" where it should
return "-07" since -25200 denotes 7 hours west of UTC. This is due to a blunder
in my commit fdb1ba144ca61185e6457f092f38f59dd9bbe6a0 dated 2016-04-12 09:19:11
-0700: the %Z code gets the sign wrong on purely-numeric time zones west of
Greenwich. To fix this bug I installed the second attached patch into the
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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-message-citation-line-format-Z-is-now-tz-name.patch --]
[-- Type: text/x-patch; name="0001-message-citation-line-format-Z-is-now-tz-name.patch", Size: 1519 bytes --]
From 679e05eeb97eae5a32fc67f4673b019c873ebcca Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
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'.
++++
+
+*** In message-citation-line-format the %Z format is now the time zone name
+instead of the numeric form. The %z format continues to be the
+numeric form. The new behavior is compatible with format-time-string.
+
** Ibuffer
---
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\".
All other format specifiers are passed to `format-time-string'
which is called using the date from the article your replying to, but
--
2.7.4
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Fix-format-time-string-Z-bug-with-negative-tz.patch --]
[-- Type: text/x-patch; name="0002-Fix-format-time-string-Z-bug-with-negative-tz.patch", Size: 1760 bytes --]
From 74fbe646c7d735343628979f6e9bb4543f01fe52 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
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 != 0)
prec += 2, numzone = 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 = 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")
--
2.7.4
next prev parent reply other threads:[~2017-09-18 3:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-17 5:14 bug#28476: 26.0.60; Gnus: broken timezone in citation line Mike Kupfer
2017-09-17 14:25 ` Eli Zaretskii
2017-09-17 15:29 ` Mike Kupfer
2017-09-17 15:59 ` Andreas Schwab
2017-09-17 16:12 ` Eli Zaretskii
2017-09-18 3:56 ` Paul Eggert [this message]
2017-09-18 15:37 ` Mike Kupfer
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=d31ba1ed-26e6-6fab-41a8-e94b3a6ffe13@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=28476@debbugs.gnu.org \
--cc=mkupfer@alum.berkeley.edu \
/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.