From: Yuri Khan <yuri.v.khan@gmail.com>
To: Tino Calancha <tino.calancha@gmail.com>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: Generalize and standarize dired-plural-s
Date: Sun, 18 Sep 2016 23:45:09 +0600 [thread overview]
Message-ID: <CAP_d_8V2O45T42j+1TOjoXEOyTV-6NBPMiUb_XXvphRhA5sz-w@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1609182258230.29669@calancha-pc>
On Sun, Sep 18, 2016 at 9:00 PM, Tino Calancha <tino.calancha@gmail.com> wrote:
> 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 length
>>1.
> If ARG is =1 or a sequence of length =1, 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] → -ves, -x → -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.
next prev parent reply other threads:[~2016-09-18 17:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-18 14:00 Generalize and standarize dired-plural-s Tino Calancha
2016-09-18 15:06 ` Kaushal Modi
2016-09-18 15:12 ` Drew Adams
2016-09-18 17:45 ` Yuri Khan [this message]
2016-09-18 19:28 ` Tino Calancha
2016-09-18 20:47 ` Yuri Khan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAP_d_8V2O45T42j+1TOjoXEOyTV-6NBPMiUb_XXvphRhA5sz-w@mail.gmail.com \
--to=yuri.v.khan@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=tino.calancha@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.