From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.devel Subject: Re: Generalize and standarize dired-plural-s Date: Sun, 18 Sep 2016 23:45:09 +0600 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1474220817 3802 195.159.176.226 (18 Sep 2016 17:46:57 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 18 Sep 2016 17:46:57 +0000 (UTC) Cc: Emacs developers To: Tino Calancha Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 18 19:46:54 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1blgAw-00084r-0P for ged-emacs-devel@m.gmane.org; Sun, 18 Sep 2016 19:46:46 +0200 Original-Received: from localhost ([::1]:51033 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blgAu-0007rt-Ad for ged-emacs-devel@m.gmane.org; Sun, 18 Sep 2016 13:46:44 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blgAl-0007qz-TD for emacs-devel@gnu.org; Sun, 18 Sep 2016 13:46:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1blgAh-00026B-N7 for emacs-devel@gnu.org; Sun, 18 Sep 2016 13:46:34 -0400 Original-Received: from mail-lf0-f49.google.com ([209.85.215.49]:33126) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blgAh-00025m-Ev for emacs-devel@gnu.org; Sun, 18 Sep 2016 13:46:31 -0400 Original-Received: by mail-lf0-f49.google.com with SMTP id h127so96284010lfh.0 for ; Sun, 18 Sep 2016 10:46:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=QSOpFMZAKSFO2P5MqbhQWZUUgFw0pmPMT3ngtIXNIkA=; b=NiiAVxIWHis7sp9WxqUrGPZrwL+U+focd/1dfI6D7PWpwUqjeRVMKUhYfelVL3tzoH pd4XW2ud7rK/eV9lT9pq0RT7rqW8cr4zwS9yCx1lLpJQGYlscAadtBUJFi136+njBW3i hjYvng1HFoA5X6ddchrfvq9hWByjwxX2W1Tsg2WlWD4EoGMI2BbTackl2YP3/kKma3K/ 8s3bCnbpatS8fFGliGXRaLcphXpMFzBvjuxVlhh3kvgTRkm7M/EHUlXjMOIyBvQXefON HFc8+hSFv4JaYfreoxTIkekFD7xgENGoEV37N1EAEJTkQoiA3/6iovm1qJajniJYR34q hzJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=QSOpFMZAKSFO2P5MqbhQWZUUgFw0pmPMT3ngtIXNIkA=; b=XcycEL42dJ4OgBmJWTEz9C49PEviYBdRn9c/36ue2OqUf98I0IrMgaepckCg2tYXMK dz8AnmUVr0+n126pSiTzHfD7EDd6bfPuSUp1AERGwRW5uXHTShYFzhZgsjJiYg2scslc 6+bgCaumlFgYo4mdI7hz2ABRNoK6/5qrEcLttZV97qA/4fAoU5cWYCKjQJ4L0kyYYgiQ pQqKS607S9kYk/cJ7WvBlskjnPhuMWY4FjRSBxa/KoUtOp4GqpzwbcJTBhE+31FjOuj8 gDNbIWnYzqh0/Hm3Flx6lfmvKDRhKgqJl35yzFmmXPbQOJ+k+UXOhWxcKpDnynvnTOlj DPig== X-Gm-Message-State: AE9vXwPwAYgxzdHy2qeTUoYrrJ1Q/hF+o8uPJYbdocBaqvwGb9NJeOg+SRNBfP5vpCmbpb+2uukLL3hNUrfvew== X-Received: by 10.46.71.84 with SMTP id u81mr8835340lja.19.1474220730157; Sun, 18 Sep 2016 10:45:30 -0700 (PDT) Original-Received: by 10.114.80.163 with HTTP; Sun, 18 Sep 2016 10:45:09 -0700 (PDT) In-Reply-To: X-Google-Sender-Auth: abcP4Pm4XBSOQqXva5ZEm-11AIk X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.215.49 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:207571 Archived-At: On Sun, Sep 18, 2016 at 9:00 PM, Tino Calancha wr= ote: > I am wondering if it has sense to add a standard function, > `string-plural-s' > (defun string-plural-s (arg &optional string plural) > "\ > Return plural of STRING if ARG is nil, or an integer >1, or a seq of leng= th >>1. > If ARG is =3D1 or a sequence of length =3D1, return STRING. > Optional arg PLURAL is the plural of STRING. > If STRING is nil, return \"s\" or \"\"." The two previous replies in this thread suggest, respectively, shipping a dictionary of English irregular plurals, and implementing a mini-language suitable for encoding some but not all English plurals. (E.g. -f[e] =E2=86=92 -ves, -x =E2=86=92 -xen are not covered.) I think the original proposal (requiring both forms to be spelled in full or falling back to regular plural by passing a nil STRING) is cheaper to implement and more flexible than a hardcoded dictionary, and makes for more readable strings in source code than ~P ~:P ~@P ~:@P. It is also easier to extend to other languages, if and when we deem it necessary. (It would require passing an additional argument to specify language, and more forms (singular, dual, trial, paucal, plural).) I also suggest that the function be split in two: a core function dealing with integers only, and a convenience wrapper that also accepts sequences.