From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#71572: [PATCH] seconds-to-string-approximate Date: Sat, 22 Jun 2024 19:42:25 -0400 Message-ID: References: <86r0cpicwt.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17465"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: adam@alphapapa.net, 71572@debbugs.gnu.org, jonas@bernoul.li To: Eli Zaretskii , JD Smith Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 23 01:43:37 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 1sLAOO-0004KR-5j for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 23 Jun 2024 01:43:36 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sLANv-0008L3-RI; Sat, 22 Jun 2024 19:43:07 -0400 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 1sLANt-0008Km-5N for bug-gnu-emacs@gnu.org; Sat, 22 Jun 2024 19:43:05 -0400 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 1sLANq-0003j0-1c for bug-gnu-emacs@gnu.org; Sat, 22 Jun 2024 19:43:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sLANq-0000iZ-1p for bug-gnu-emacs@gnu.org; Sat, 22 Jun 2024 19:43:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 22 Jun 2024 23:43:01 +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.17190997572716 (code B ref 71572); Sat, 22 Jun 2024 23:43:01 +0000 Original-Received: (at 71572) by debbugs.gnu.org; 22 Jun 2024 23:42:37 +0000 Original-Received: from localhost ([127.0.0.1]:36246 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sLANR-0000hj-2m for submit@debbugs.gnu.org; Sat, 22 Jun 2024 19:42:37 -0400 Original-Received: from mail.cs.ucla.edu ([131.179.128.66]:44882) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sLANP-0000hR-Bl for 71572@debbugs.gnu.org; Sat, 22 Jun 2024 19:42:36 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 9390E3C011BC5; Sat, 22 Jun 2024 16:42:29 -0700 (PDT) Original-Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id xm0rGX843nsd; Sat, 22 Jun 2024 16:42:27 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 6CE413C011BE0; Sat, 22 Jun 2024 16:42:27 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 6CE413C011BE0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1719099747; bh=VfHaxLAwpzqvcNkXkojshlUtOU6+mo6htO/OgdaNH9w=; h=Message-ID:Date:MIME-Version:To:From; b=ONqaeR7FPi+0coUuRTXQrwdzzexrJJkJY7Q7j53uu6Puhj6NRXbReoSiLur+C7/zv t+/LgAyGnBZFmoa9Ltu2nDZrgxsVYrDqgSkoiaWzBoAelOhbxvGfNILc3k0pAxJGFe 0jK/e4YMro70FjgPUNTrCK5h5Ie2ooMIsLeZV/rW+TG078Sp1jlKFfBkt2IcHWjZUg enueuIqwMIrxQ9KSqV6tMXV1a6lxru6M9IjLKhCejZNgwvP2ViHacD6bvjwkiAS64v vFUmT6i7iGnx359F3A0F9IS7UVOnzY36K9KF7AFiWW9+NEtSQ4knNtakcPjXmLtx6I XnVjTiOsGyR6w== X-Virus-Scanned: amavis at mail.cs.ucla.edu Original-Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id ZZZxdHxlwFk6; Sat, 22 Jun 2024 16:42:27 -0700 (PDT) Original-Received: from [192.168.184.241] (unknown [165.166.182.66]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id D9D903C011BC5; Sat, 22 Jun 2024 16:42:26 -0700 (PDT) Content-Language: en-US In-Reply-To: <86r0cpicwt.fsf@gnu.org> 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:287746 Archived-At: On 6/22/24 04:45, Eli Zaretskii wrote: >> Cc: Adam Porter , jonas@bernoul.li >> From: JD Smith >> Date: Sat, 15 Jun 2024 13:24:00 -0400 >> >> A very useful and widely used time operation is to approximate a given= delay or age (in seconds) using a human-readable unit =E2=80=94 think "2= hours", "5 days", "3 weeks", or "7 months". We have `seconds-to-string= ', but it provides more precision than is often required, skips some mean= ingful "human readable" duration units like weeks and months, and uses ab= breviated units exclusively. >> >> For those familiar with magit, the `magit--age' function has provided = this capability for quite some time (e.g. for short commit age), and othe= r packages have adapted it. It would be useful to have a version in core= . >> >> This patch provides a `seconds-to-string-approximate' function based l= oosely on `magit--age' and `seconds-to-string'. It allows using abbrevia= ted or full units, and can optionally round to the nearest half-unit. >=20 > Paul, any comments to the patch? For starters: Why define a new function, instead of adding optional arguments to the=20 existing one? Why not look at what mastodon.el does, as the comment in=20 seconds-to-string suggests? For example, mastodon-tl--human-duration=20 lets you specify whatever resolution you want, instead of limiting you=20 to either 0.5 or 1 as in the proposed patch. Isn't the master branch was in an long-term sort-of-frozen state, until=20 a branch is created for Emacs 30? If so I imagine changes in this area=20 should wait.