From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs Subject: bug#641: format-time-string %Z does not work, starting with Emacs 22.2 Date: Tue, 5 Aug 2008 16:54:32 -0700 Message-ID: <008601c8f756$9bce0f00$0200a8c0@us.oracle.com> References: <4897737C.90709@gmx.at> <001501c8f67e$7c63b300$0200a8c0@us.oracle.com> Reply-To: Drew Adams , 641@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1217981285 15123 80.91.229.12 (6 Aug 2008 00:08:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 6 Aug 2008 00:08:05 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org To: "'Eli Zaretskii'" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 06 02:08:55 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KQWaC-0001OE-96 for geb-bug-gnu-emacs@m.gmane.org; Wed, 06 Aug 2008 02:08:52 +0200 Original-Received: from localhost ([127.0.0.1]:56710 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KQWZG-000674-Qg for geb-bug-gnu-emacs@m.gmane.org; Tue, 05 Aug 2008 20:07:54 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KQWZB-00064Y-J0 for bug-gnu-emacs@gnu.org; Tue, 05 Aug 2008 20:07:49 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KQWZ9-00060H-Mi for bug-gnu-emacs@gnu.org; Tue, 05 Aug 2008 20:07:49 -0400 Original-Received: from [199.232.76.173] (port=59681 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KQWZ9-0005zx-Hw for bug-gnu-emacs@gnu.org; Tue, 05 Aug 2008 20:07:47 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:56971) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KQWZ9-0001MK-2B for bug-gnu-emacs@gnu.org; Tue, 05 Aug 2008 20:07:47 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m7607MUd018252; Tue, 5 Aug 2008 17:07:23 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m76056sr017061; Tue, 5 Aug 2008 17:05:06 -0700 X-Loop: don@donarmstrong.com Resent-From: "Drew Adams" Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs , don@donarmstrong.com Resent-Date: Wed, 06 Aug 2008 00:05:05 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 641 X-Emacs-PR-Package: emacs,w32 X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.121798053914519 (code B ref -1); Wed, 06 Aug 2008 00:05:05 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 5 Aug 2008 23:55:39 +0000 Original-Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m75NtZdR014513 for ; Tue, 5 Aug 2008 16:55:36 -0700 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KQWNK-0002Qy-HK for bug-gnu-emacs@gnu.org; Tue, 05 Aug 2008 19:55:34 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KQWNJ-0002Qb-RE for bug-gnu-emacs@gnu.org; Tue, 05 Aug 2008 19:55:34 -0400 Original-Received: from [199.232.76.173] (port=43819 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KQWNJ-0002QQ-G9 for bug-gnu-emacs@gnu.org; Tue, 05 Aug 2008 19:55:33 -0400 Original-Received: from rgminet01.oracle.com ([148.87.113.118]:22644) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KQWNE-0008Pn-2Q; Tue, 05 Aug 2008 19:55:28 -0400 Original-Received: from agmgw2.us.oracle.com (agmgw2.us.oracle.com [152.68.180.213]) by rgminet01.oracle.com (Switch-3.2.4/Switch-3.1.6) with ESMTP id m75NtG11022293; Tue, 5 Aug 2008 17:55:16 -0600 Original-Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by agmgw2.us.oracle.com (Switch-3.2.0/Switch-3.2.0) with ESMTP id m75KT0r3028914; Tue, 5 Aug 2008 17:55:14 -0600 Original-Received: from inet-141-146-46-1.oracle.com by acsmt354.oracle.com with ESMTP id 11255745391217980472; Tue, 05 Aug 2008 16:54:32 -0700 Original-Received: from dradamslap1 (/69.181.100.12) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 05 Aug 2008 16:54:32 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: Acj3KiFVg8TfjNZgRweKkB3twmWPeAAKBhNA X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Resent-Date: Tue, 05 Aug 2008 20:07:49 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:19057 Archived-At: > > > From: martin rudalics Sent: Monday, August 04, 2008 2:24 PM > > > > emacs -Q > > > > M-: (format-time-string "%Z) ==> "" > > > > M-: (format-time-string "%z) ==> "-0700" > > > > > > > > The %Z string is incorrect. In my case, it should be > > > > (as it is in > > > > Emacs 20 and Emacs 22.1): "Pacific Daylight Time". > > > > > > > > This same bug appears in Emacs 23. This is a > > > > regression from Emacs 22.1. > > > > > > See > > > 2007-06-07 Jason Rumney > > > * s/ms-w32.h: Don't define HAVE_TZNAME. > > > * editfns.c (Fcurrent_time_zone): Remove hack for > > > Japanese Windows. > > > > > > and the preceding discussion starting with > > > http://lists.gnu.org/archive/html/emacs-devel/2007-06/msg00334.html > > > > Sorry; I don't know what all of that means. > > What it means is that we did this on purpose, and therefore the fact > you get an empty string for %Z is not a bug. OK, call it an incompatible change, if you prefer. You intentionally broke existing code and reduced the utility of the function and the fidelity of its doc string and Elisp doc. Count me as one user who disagrees with the change, whether bug or by design. Not only does it break my existing code, but I don't see any way now to get a timezone name (on Windows) even by changing the code. Can you tell me how to do that? If so, please document it. > > It is obviously a bug, however, that %Z produces an empty > > time-zone string. I use it for a time stamp, for instance, > > with this form: > > (format-time-string "%a %b %e %T %Y (%Z)") > > > > After the change that introduced the bug, I get this: > > Mon Aug 4 15:01:16 2008 () > > instead of this: > > Mon Aug 4 15:01:16 2008 (Pacific Daylight Time) > > "Pacific Daylight Time" is not a Posix- or RFC-822 compliant timezone > specification. So? What requires `format-time-string' to use only Posix- or RFC-822 specs? * The doc string says nothing about Posix or RFC-822. The Elisp manual is just as silent about this. * The function previously DTRT for %Z, at least on Windows. * The doc string still refers to %Z as producing the timezone name, and "" is surely not a timezone name (for humans, even if it is for Posix). I'd call that, in itself, a bug - at the very least, a doc bug. Or did you also intentionally make the doc speak against the behavior? * The Elisp manual says that %Z produces "the time zone abbreviation (e.g., `EST')", which is different from what the doc string says ("name" vs "abbreviation"), and which is apparently also wrong. In Emacs 22, I get "Pacific Daylight Time", not "PDT" (on Windows). * %Z producing "" is less useful (not useful at all, in my eyes) for most purposes, even if it is a Posix- or RFC-822 compliant timezone spec. > It comes from the MS-Windows version of `tzname', > which produces RFC-compliant TZ strings only for a very small subset > of timezone specifications, and even that only after you call `tzset' > from within an application. So we disabled the use of `tzname' on > Windows to avoid producing non-compliant timezone strings, which could > break others, e.g. if used in an email message header. > > Posix specifies that if `tzname' is not available, %Z should produce > an empty string. This means that an empty string is a valid result of > format-time-string for %Z, and if you use %Z in your Lisp code, you > should make allowances for the case of an empty string, no matter on > which platform. The doc string does not mention this. And it does not refer the reader to the Posix spec (which would be only slightly more help than saying nothing). AFAICT, the functionality and usefulness has been reduced. At least on Windows, IIUC, one can no longer use %Z - you just get "", which is useless. This is strictly a loss, whatever plusses elsewhere might be seen to compensate it. If you absolutely need a Posix-compliant spec for some use (e.g. mail), why don't you add a new one - %P, for instance, instead of changing the meaning and behavior of the existing %Z and thus introducing incompatibility? We didn't change the Emacs regexp syntax when we introduced Posix regexp support - we added separate Posix functions (that's TRT). IIUC, you offer Windows users no way to get a timezone name now. You certainly don't offer the *same* way to do that, so even if there is a way (is there?), it means needing different code for different Emacs versions. Are you really convinced this is TRT?