[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RFC: locale-sensitive Emacs functions
From: |
Ted Zlatanov |
Subject: |
Re: RFC: locale-sensitive Emacs functions |
Date: |
Tue, 28 Mar 2017 08:45:13 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
On Tue, 28 Mar 2017 07:59:25 -0400 Gdobbins <address@hidden> 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