all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ted Zlatanov <tzz@lifelogs.com>
To: emacs-devel@gnu.org
Subject: Re: RFC: locale-sensitive Emacs functions
Date: Tue, 28 Mar 2017 08:45:13 -0400	[thread overview]
Message-ID: <87h92d604m.fsf@lifelogs.com> (raw)
In-Reply-To: DUkEbNKVK1611uZJHQLMjX4QQRzby0Sg5dlDxNIC9xN1Xp_3ujOAi5g4L6azht5tKDB1qpql6BokG-QJoixg_VYpVFXX3HTa6fwTV3orFeI=@protonmail.com

On Tue, 28 Mar 2017 07:59:25 -0400 Gdobbins <gdobbins@protonmail.com> wrote: 

>> I remember concluding that I was glad I didn't have to write code to support the '
>> flag, as it would require messing with the LC_NUMERIC locale setting (currently
>> hardwired to "C" for other good reasons) and would make for some work redoing
>> carefully-calculated output buffer sizes internal to 'format', not to mention
>> the character set conversion that would be required.

G> The way I've proposed should obviate those problems. Since the variables
G> governing the behavior are set by the user, LC_NUMERIC need not be consulted. If
G> it is deemed necessary a function like set-locale-dependent-vars could be
G> created to set these (and potentially other) variables, and the user could put
G> it in their init if they so choose.

Right, so you're *ignoring* the locale, and making "%'d" an
Emacs-specific thing because it doesn't follow the C behavior. I agree
that's a clean approach.

>> For what it's worth, the Common Lisp approach cannot handle the Indian numbering
>> system, which has a comma every two digits except that the last grouping
>> contains three digits (e.g., "12,34,56,789").

G> The literal CL approach can't handle it, but it can be adapted to do so. The
G> attached patch makes it so the format-digit-grouping variable can be a list. The
G> first element of the list controls the grouping size of the least significant
G> figures etc. until the last element controls all remaining groups. Using your
G> example:

G> (let ((format-digit-grouping '(3 2)))
G> (format "%'d" 123456789)) => "12,34,56,789"

I like the patch and the proposed approach, and if there are no
objections, and with some tests, I think it would be good to go.

Ted




  reply	other threads:[~2017-03-28 12:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-28  3:06 RFC: locale-sensitive Emacs functions Ted Zlatanov
2017-03-28  4:10 ` Gdobbins
2017-03-28  4:37   ` Paul Eggert
2017-03-28 11:59     ` Gdobbins
2017-03-28 12:45       ` Ted Zlatanov [this message]
2017-03-30 18:27         ` Ted Zlatanov
2017-03-31  4:27           ` Gdobbins
2017-03-31 17:59             ` Davis Herring
2017-03-28 19:37       ` Paul Eggert

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=87h92d604m.fsf@lifelogs.com \
    --to=tzz@lifelogs.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 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.