unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: CSV parsing and other issues (Re: LC_NUMERIC)
@ 2021-06-06 23:36 Boruch Baum
  2021-06-07 12:28 ` Eli Zaretskii
  0 siblings, 1 reply; 33+ messages in thread
From: Boruch Baum @ 2021-06-06 23:36 UTC (permalink / raw)
  To: Emacs-Devel List; +Cc: Maxim Nikulin, Eli Zaretskii

I wasn't cc'ed (and I don't subscribe to the list), so I only now saw
the continuation of my post.

1] @Maxim: You seemed to indicate that the default emacs locale is 'C'.
   That may be true, and I may be mixing up two separate things, but my
   observation is that I get 'nil' when I check for any related
   environment variable using function `getenv', and in practice I need
   to temporarily manually use function setenv to set LC_COLLATE=C in
   order to offer several sorting options in package diredc. Note though
   that feature isn't performing the sort within emacs; it's temporarily
   setting a shell environment and having the external ls program
   perform the sort for emacs-core dired. Thus, my experience has been
   that the default has been something other than C, at least for
   LC_COLLATE. I suspect that's true for ALL emacs users.

2] @Eli: You wrote

> > The problem with that, of course, is that not every supported
> > platform can dynamically change the locale, let alone do that
> > efficiently.

   I have no idea to what actual supported platform you're referring.

3] @ELi: Your wrote

> > Text processing in Emacs is generally separate from the current
> > locale's rules,
> > ...
> > So passing a locale argument to functions that produce output,
> > with the intent to request some behavior to be tailored to that
> > locale, is the only reasonable way to have this kind

   Agreed. My input here is that there should be clear documentation of
   how to retrieve a value for that argument from a buffer's context,
   (maybe the same way that flyspell does?).

I see also that I created room for confusion in asking actually for TWO
features (single-quote and upper-case I) because the two will behave
differently in an expected default condition. The single quote format
(for the thousands separator) can be expected to produce a result always
for all conditions of locale, while I expect most locale cases won't
produce any special output for the upper-case I format option.


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



^ permalink raw reply	[flat|nested] 33+ messages in thread
* LC_NUMERIC formatting [FEATURE REQUEST]
@ 2021-06-02 18:54 Boruch Baum
  2021-06-03 14:44 ` CSV parsing and other issues (Re: LC_NUMERIC) Maxim Nikulin
  0 siblings, 1 reply; 33+ messages in thread
From: Boruch Baum @ 2021-06-02 18:54 UTC (permalink / raw)
  To: Emacs-Devel List

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



^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2021-06-16 17:36 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-06 23:36 CSV parsing and other issues (Re: LC_NUMERIC) Boruch Baum
2021-06-07 12:28 ` Eli Zaretskii
2021-06-08  0:45   ` Boruch Baum
2021-06-08  2:35     ` Eli Zaretskii
2021-06-08 15:35       ` Stefan Monnier
2021-06-08 16:35       ` Maxim Nikulin
2021-06-08 18:52         ` Eli Zaretskii
2021-06-10 16:28           ` Maxim Nikulin
2021-06-10 16:57             ` Eli Zaretskii
2021-06-10 18:01               ` Boruch Baum
2021-06-10 18:50                 ` Eli Zaretskii
2021-06-10 19:04                   ` Boruch Baum
2021-06-10 19:23                     ` Eli Zaretskii
2021-06-10 20:20                       ` Boruch Baum
2021-06-11  6:19                         ` Eli Zaretskii
2021-06-11  8:18                           ` Boruch Baum
2021-06-11 16:51                           ` Maxim Nikulin
2021-06-11 13:56                       ` Filipp Gunbin
2021-06-11 14:10                         ` Eli Zaretskii
2021-06-11 18:52                           ` Filipp Gunbin
2021-06-11 19:34                             ` Eli Zaretskii
2021-06-11 16:58               ` Maxim Nikulin
2021-06-11 18:04                 ` Eli Zaretskii
2021-06-14 16:38                   ` Maxim Nikulin
2021-06-14 17:19                     ` Eli Zaretskii
2021-06-16 17:27                       ` Maxim Nikulin
2021-06-16 17:36                         ` Eli Zaretskii
2021-06-10 21:10             ` Stefan Monnier
2021-06-12 14:41               ` Maxim Nikulin
  -- strict thread matches above, loose matches on Subject: below --
2021-06-02 18:54 LC_NUMERIC formatting [FEATURE REQUEST] Boruch Baum
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

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).