From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#52209: 28.0.60; [PATCH] date-to-time fails on pure dates Date: Mon, 03 Jan 2022 12:34:33 +0100 Message-ID: <87mtkd3vee.fsf@gnus.org> References: <7c22f300-eedb-da65-db02-e82025ec2f48@cs.ucla.edu> <25023.40959.627321.685762@orion.rgrjr.com> <875yrjpp03.fsf@gnus.org> <25024.42989.718735.680188@orion.rgrjr.com> <871r26i5n0.fsf@gnus.org> <25028.53876.304365.706795@orion.rgrjr.com> <87zgoq2vwm.fsf@gnus.org> <25029.60989.564217.290743@orion.rgrjr.com> <87bl1428x5.fsf@gnus.org> <25031.40994.286546.498819@orion.rgrjr.com> <87ee5zzjpg.fsf@gnus.org> <25035.12991.328986.987982@orion.rgrjr.com> <87o84z782g.fsf@gnus.org> <25038.8156.470964.935330@orion.rgrjr.com> <87lezz5x92.fsf@gnus.org> <87h7an7bdm.fsf@igel.home> <25040.62646.635818.692654@orion.rgrjr.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26748"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 52209@debbugs.gnu.org, Andreas Schwab , Paul Eggert To: Bob Rogers Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 03 12:35:31 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n4Lcg-0006m2-1L for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 03 Jan 2022 12:35:30 +0100 Original-Received: from localhost ([::1]:37996 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4Lce-0002AC-Si for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 03 Jan 2022 06:35:28 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:53662) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4LcE-000256-5c for bug-gnu-emacs@gnu.org; Mon, 03 Jan 2022 06:35:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50969) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n4LcD-0004hI-QS for bug-gnu-emacs@gnu.org; Mon, 03 Jan 2022 06:35:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n4LcD-0006NC-PO for bug-gnu-emacs@gnu.org; Mon, 03 Jan 2022 06:35:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 03 Jan 2022 11:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52209 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 52209-submit@debbugs.gnu.org id=B52209.164120968924478 (code B ref 52209); Mon, 03 Jan 2022 11:35:01 +0000 Original-Received: (at 52209) by debbugs.gnu.org; 3 Jan 2022 11:34:49 +0000 Original-Received: from localhost ([127.0.0.1]:34282 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n4Lc1-0006Mj-DK for submit@debbugs.gnu.org; Mon, 03 Jan 2022 06:34:49 -0500 Original-Received: from quimby.gnus.org ([95.216.78.240]:35680) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n4Lbz-0006MS-7K for 52209@debbugs.gnu.org; Mon, 03 Jan 2022 06:34:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=oAL6sCQvLy8rLohfi30IWA+gcEtvC7/wE5UVjOlMB0s=; b=hhMR1x+xEHRlgu+nIOaJviKeSq /hzH+rw3tp0n4sFK3V4KXS5b5qVTOEUXhAVltnRHCKBIYVXfS4izhA0OK+yQxJooiP5788g23UgGQ ATqK2huZxJPzv4g7iW+/5ZPnfj4taEafIgubiPiCL4HkdcYdK0JJFwS5kPejMF6qDEaY=; Original-Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n4Lbn-0003y6-Tb; Mon, 03 Jan 2022 12:34:39 +0100 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAFVBMVEXh39ixp6Xk4tyC paqLtdhwmln///9J99hjAAAAAWJLR0QGYWa4fQAAAAlwSFlzAAAuIwAALiMBeKU/dgAAAAd0SU1F B+YBAwsDAupqCW8AAAFwSURBVDjLfZTLbgIxDEUdq907PPZOKj4Addi3mmFf2ub/fwXbeUwyAowE wSf32glmAB6HW5cEjggAowZbyt6ZvAAGZFamKduATKqKliuSuAmUlwJs32t42SweuFUEvxNnFYRd n2cvINd21AMnwJpCWeIgEJCbcufmxfBtIFpTsrT+3xaJDcjJDmhX6lqyn8syVyAte78vwHcKiB2Y nymWBqAD85Tt2jlCVRwqIANYweVvBDHsDVxSmgarorimlP4bgAImEyTzOouVTQE6A0mjgjJCL8Es 6UsarazG1RRTD/SuHgF8CQ4FfOWSGeglApwM2O8OHvLJWe4mBs3f8kQA5QllnR5W8FNGBYtCp4qP An7X6VpnWsE6qrCC92fglI4r4I58CMCuhJwjQ74BxQFYf/IJsdkONZiHfw90u/LWDRAfbUU8eQBM rDdKAcl1TwaMQVDwDXB7jgTnKByBkITVpFZgzz448Lwjj52gPWm6uAPVZ4pWjBaclQAAAA5lWElm SUkqAAgAAAAAAAAAAABvylxHAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIyLTAxLTAzVDExOjAzOjAx KzAwOjAw0T8TnAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMi0wMS0wM1QxMTowMzowMSswMDowMKBi qyAAAAAASUVORK5CYII= X-Now-Playing: Genesis's _Duke_: "Turn It On Again" In-Reply-To: <25040.62646.635818.692654@orion.rgrjr.com> (Bob Rogers's message of "Sat, 1 Jan 2022 19:41:26 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:223582 Archived-At: Bob Rogers writes: > And in that context, it may make more sense to say, "Use the original > parse-time-string if you know you have email dates, or iso8601-parse if > you have dates that conform to ISO-8601," rather than having parse-date > handle them itself. Yeah. And rename `parse-time-string' to something less confusing. > So how about just adding something that makes parsing common date > formats easier, but without being DWIM or being hard-coded . . . > > I think that'd be more generally useful. > > Perhaps, but I see that as a different problem: One where you have a > date or set of dates in a precise format and just need to knock them > out. I was trying to solve the problem where you have date(s) that you > only know the general origin (e.g. North America) and don't know whether > they are numeric, alphabetic, or how precise, and just want the parser > to do the best it can, and signal a reasonably informative error rather > than return an incorrect result. Yes, I think a function like that would be welcomed by many... but would then lead to an endless series of patches as it'd be extended because it doesn't work correctly on dates from, say, Iceland. That is, a DWIM function would never be finished. > On Jan 01 2022, Lars Ingebrigtsen wrote: > > > (parse-time "%Y/%m/%d" "2021/01/01") > > => (nil nil nil 01 01 2021) > > Aka strptime. > > Oh, you're talking about the POSIX strptime, not the Perl Date::Parse > strptime, which is free-form. Not being a C programmer, I was not aware > of the POSIX version. But now I know where the odd name came from. ;-} POSIX strptime isn't very useful, because if you know the format that precisely, you might as well just write a regexp for it yourself. But something like that, but with more sloppiness (i.e., allowing regexp matching for the non-time bits) might be useful. (And I think if we had that, then implementing DWIM-ish parsing of, say, US dates on top of that would be a matter of writing a series of these strings to match them. Probably.) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no