unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Boruch Baum <boruch_baum@gmx.com>
To: Emacs-Devel List <emacs-devel@gnu.org>
Subject: LC_NUMERIC formatting [FEATURE REQUEST]
Date: Wed, 2 Jun 2021 14:54:41 -0400	[thread overview]
Message-ID: <20210602185441.nhvhirdffamahgfy@E15-2016.optimum.net> (raw)

Please consider having the elisp 'format' function adopt the
single-quote and 'I' flags. Each is already implemented in both the GNU
C printf command and the linux printf command. The single-quote flag is
part of the 'Single UNIX Specification' and the 'I' flag has been part
of glibc since version 2.2 [ref: man(3) printf].

If function 'format' uses 'printf' as its backend, this would seem to be
a matter of exposing an existing feature.

The single-quote flag applies a locale's thousands' grouping characters
if appropriate, which I only find currently implemented as user-defined
functions, ie. outside of emacs-core.

   $ printf "%'d\n" 1234
   1,234

The 'I' flag [from man(3) printf]:

   uses the locale's alternative output digits, if any. For example,
   since glibc 2.2.3 this will give Arabic-Indic digits in the Persian
   ("fa_IR") locale.

   $ LC_ALL=fa_IR.utf8 /usr/bin/printf "%Id\n" 1234
   ۱۲۳۴
   $ LC_ALL=fa_IR.utf8 /usr/bin/printf "%'Id\n" 1234
   ۱٬۲۳۴

--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0



             reply	other threads:[~2021-06-02 18:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-02 18:54 Boruch Baum [this message]
2021-06-03 14:44 ` CSV parsing and other issues (Re: LC_NUMERIC) Maxim Nikulin
2021-06-03 15:01   ` Eli Zaretskii
2021-06-04 16:31     ` Maxim Nikulin
2021-06-04 19:17       ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210602185441.nhvhirdffamahgfy@E15-2016.optimum.net \
    --to=boruch_baum@gmx.com \
    --cc=emacs-devel@gnu.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).