From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: john muhl Newsgroups: gmane.emacs.bugs Subject: bug#71572: [PATCH] seconds-to-string-approximate Date: Sun, 08 Dec 2024 16:51:51 -0600 Message-ID: <871pyhu6t4.fsf@pub.pink> References: <86r0cpicwt.fsf@gnu.org> <86msmxafog.fsf@gnu.org> <3530cd89-b5a2-4b25-95bf-1896c8ee4aef@cs.ucla.edu> <8CC4B1BB-B56A-4C3E-8B51-0E2D5B65C296@gmail.com> <86jzcbir3c.fsf@gnu.org> <874j3f2tga.fsf@pub.pink> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33169"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.12.1; emacs 31.0.50 Cc: Adam Porter , 71572@debbugs.gnu.org, Eli Zaretskii , Jonas Bernoulli , Paul Eggert To: JD Smith Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 08 23:53:18 2024 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 1tKQ9M-0008UG-60 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 08 Dec 2024 23:53:17 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKQ9B-0000ue-AP; Sun, 08 Dec 2024 17:53:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tKQ99-0000te-Uv for bug-gnu-emacs@gnu.org; Sun, 08 Dec 2024 17:53:04 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKQ99-0006t6-LI for bug-gnu-emacs@gnu.org; Sun, 08 Dec 2024 17:53:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=hlN+YMC1Ftovu+mco+4P1yIsUGmK8nYNti+2VvLgucs=; b=jgVz2tekfbp4D3zSbPTI1CMmn0/eLy2YfORa+095L2hyocf/MHEQWRV9G+/j/kgo0c8SKq//IqoCydVzBAHnE47+pHjcEI9ki9XKg0NWeChZhMfY/o8F3fK5x3LhtPO2CCLjYnNzp9/PhWNwPS89BGokHBKEN/iUzHRNTbXSM4epWa4fxqB9RSE/0e5pL2kYawauhYg5FkHeqCgNE7iQnoyd0Yl2pLPJFr9GGeSUsMp3JVv/xhgsf3cdAh1aZVJGgCJN9svez8e3XfpDu1janIvnVoKCIREzZpS9lAqEeI0vl51FTapV2ANO4YksxV4b1CzZtPgZFZqsv8mD8d9oLg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tKQ98-0004Qu-G0 for bug-gnu-emacs@gnu.org; Sun, 08 Dec 2024 17:53:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: john muhl Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Dec 2024 22:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71572 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 71572-submit@debbugs.gnu.org id=B71572.173369832516955 (code B ref 71572); Sun, 08 Dec 2024 22:53:02 +0000 Original-Received: (at 71572) by debbugs.gnu.org; 8 Dec 2024 22:52:05 +0000 Original-Received: from localhost ([127.0.0.1]:51968 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKQ89-0004P7-Fs for submit@debbugs.gnu.org; Sun, 08 Dec 2024 17:52:05 -0500 Original-Received: from fout-a7-smtp.messagingengine.com ([103.168.172.150]:45257) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKQ87-0004Ol-17 for 71572@debbugs.gnu.org; Sun, 08 Dec 2024 17:52:00 -0500 Original-Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfout.phl.internal (Postfix) with ESMTP id EBF201383707; Sun, 8 Dec 2024 17:51:53 -0500 (EST) Original-Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Sun, 08 Dec 2024 17:51:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pub.pink; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1733698313; x=1733784713; bh=hlN+YMC1Ftovu+mco+4P1yIsUGmK8nYNti+2VvLgucs=; b= roonxBKKzb9MZg4LWV5j30JJ+PeasFFW+d3NYED5+AuEzuhRwfF5XHzw9jzo+dVi KpiUYCyC96o0C2Z7ARdngAsRJsayRuorTbYLMmD+2an2zzXR+S3MMtD8CKylSfso 1jYCEGLrEoavXC9Db//s4OjewxdRvmyML6YZjt0SdKUcr3ohBIddfMHxBIP7EyeO jiJjE8C26gfckBnExlKy6W7X5Mi3UpzLB8TuNGQE5fjsQZO3qhe1O/cB7KzJAG5d c4oMXcBHepIcmuQ4EV+rV21yWZMC+wYZ4jsAstuvn+NZlWCcjeEud4MsAOhXj1MX mNv8Eyavh9jb+pqy32lqyg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1733698313; x= 1733784713; bh=hlN+YMC1Ftovu+mco+4P1yIsUGmK8nYNti+2VvLgucs=; b=o DlaUyiIsjv800VX7FLaFmrhvbI57x0mPVkXa2fdEHYK7U931e07rTg/JbsfMWic8 GovFze/gKuqO6sCRCLiEMPavf289Tp5Kxb9/SqI1NIGIGd6mQBlN2+zXliuOXG4J d6yXm4Lce5XqiFsDcuZGxSgQDl2z5CjLutcgrDxoFHNoCnLJvp9JOfchwQOKR8yx TmsC77TrGV985OFEKP2CxZC328IvtqqZ0nSTJjaeWYDnI/kcKx5sbD/x3UULNLDH A+mkNxqOfWe8huq8esOnBanaY3+SJZoIcgmQaXvfteNW566NC4wDoUrgwtRRREqg BRskl8RHvfGG3DcvXsVxQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrjeeggddtfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenucfjughrpefhvfevufgjfhgffffkgggtgfesthhqredttderjeen ucfhrhhomhepjhhohhhnuchmuhhhlhcuoehjmhesphhusgdrphhinhhkqeenucggtffrrg htthgvrhhnpeegveehvddttedvkeduvddttdehhfdvgffgvdfgiedtjeduhefhffejtddv veevkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hjmhesphhusgdrphhinhhkpdhnsggprhgtphhtthhopeeipdhmohguvgepshhmthhpohhu thdprhgtphhtthhopegvghhgvghrthestghsrdhutghlrgdrvgguuhdprhgtphhtthhope hjohhnrghssegsvghrnhhouhhlrdhlihdprhgtphhtthhopeejudehjedvseguvggssghu ghhsrdhgnhhurdhorhhgpdhrtghpthhtoheprggurghmsegrlhhphhgrphgrphgrrdhnvg htpdhrtghpthhtohepvghlihiisehgnhhurdhorhhgpdhrtghpthhtohepjhguthhsmhhi thhhsehgmhgrihhlrd X-ME-Proxy: Feedback-ID: i74194916:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 8 Dec 2024 17:51:52 -0500 (EST) In-Reply-To: (JD Smith's message of "Mon, 9 Dec 2024 04:52:56 +0900") 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:296669 Archived-At: JD Smith writes: > On Dec 8, 2024, at 4:17=E2=80=AFAM, john muhl wrote: > > JD Smith writes: > > On Dec 7, 2024, at 8:02=E2=80=AFAM, Eli Zaretskii wrote: > > From: JD Smith > Date: Sat, 30 Nov 2024 13:58:52 -0500 > Cc: Eli Zaretskii , > Adam Porter , > jonas@bernoul.li, > Paul Eggert > > I was recently reminded of the need for a more capable seconds-to-string= .=20=20 > > Anyone have any additional comments on this proposed patch? If not, > I'd suggest someone with access > merges. > > A few minor nits below, and then we can install: > > Thanks. Updated patch below. > > Thanks for working on this. I gave a quick try and noticed some > amounts aren=E2=80=99t pluralized how I expect; e.g. > > (seconds-to-string 36541462 'expanded nil 1) > ;; "1 year 1.9 month" > > ... > > According to the Chicago Manual of Style all fractional values are > plural, even 1.0, 2.0 &c. > > Thanks for this, a case I hadn't tested. Corrected in the attached. Looks good but the bigger interval is still always singular in the expanded w/ precision case: (seconds-to-string 73082924 'expanded nil 2) ;; "2 year 3.79 months" ;; ^ should be years I got it working with: @@ -477,7 +477,7 @@ seconds-to-string (concat (when here-pre (concat (number-to-string cnt-pre) padding - (unit (* cnt-pre round-to) here-pre) " ")) + (unit (* cnt-pre round-to) here-pre (> cnt-pre 1)) " ")) (if isfloatp (format dformat cnt-val) (number-to-string (floor cnt-val))) padding Thanks again.