From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.devel Subject: Re: RFC: locale-sensitive Emacs functions Date: Tue, 28 Mar 2017 08:45:13 -0400 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <87h92d604m.fsf@lifelogs.com> References: <87lgrq5ccp.fsf@lifelogs.com> <8Sj4h1O1rGU3p2OhVtn_8rleNKxYpeaUgnELj6kkM2iv3vXZWKaY0viThS1GwHfnf3EhDqooeJbfbOvbk-YBLpVI4znjtvf9Ot3G4ej8YJM=@protonmail.com> <721338e4-fad3-e33c-2a77-59107fbe1ff2@cs.ucla.edu> Reply-To: emacs-devel@gnu.org NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1490705213 28178 195.159.176.226 (28 Mar 2017 12:46:53 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 28 Mar 2017 12:46:53 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Mar 28 14:46:45 2017 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 1csqWI-0006LH-Ar for ged-emacs-devel@m.gmane.org; Tue, 28 Mar 2017 14:46:42 +0200 Original-Received: from localhost ([::1]:53085 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csqWO-0000q9-3U for ged-emacs-devel@m.gmane.org; Tue, 28 Mar 2017 08:46:48 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44155) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csqVN-0000os-SP for emacs-devel@gnu.org; Tue, 28 Mar 2017 08:45:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1csqVJ-0007uz-Sz for emacs-devel@gnu.org; Tue, 28 Mar 2017 08:45:45 -0400 Original-Received: from [195.159.176.226] (port=53754 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1csqVJ-0007tf-La for emacs-devel@gnu.org; Tue, 28 Mar 2017 08:45:41 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1csqUy-00074V-1F for emacs-devel@gnu.org; Tue, 28 Mar 2017 14:45:20 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 35 Original-X-Complaints-To: usenet@blaine.gmane.org X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" Mail-Copies-To: never Cancel-Lock: sha1:YbkdNtuIJqZg/PW9N9yoxBRfccc= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 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:213444 Archived-At: On Tue, 28 Mar 2017 07:59:25 -0400 Gdobbins 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