help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Alternative to string< that works "well" with unicode


From: Rasmus
Subject: Re: Alternative to string< that works "well" with unicode
Date: Fri, 28 Nov 2014 09:43:50 +0100
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.4.51 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Rasmus <rasmus@gmx.us>
>> Date: Fri, 28 Nov 2014 01:32:00 +0100
>
>> 
>> > I think Emacs bug#18051 is relevant.
>> 
>> Thanks, the bug pointed me to `string-collate-lessp':
>> 
>> (sort '(É E T A À Z) 'string-collate-lessp)
>>       => (A À E É T Z)
>> 
>> Pretty cool!
>
> Yes, it is.  But please be aware that the results are heavily
> locale-dependent; in particular, a non-UTF-8 locale on a typical
> GNU/Linux system might behave very differently.  Likewise on systems
> where the standard C library is not glibc.
>
> The upshot of all this is that the results of such sorting are
> excellent from the local user POV, but should not be considered as
> stable across locales and systems, and therefore Lisp programs that
> are expected to be distributed should not rely on the resulting order
> too much.

The particular usecase I  had in mind is sorting in EMMS.  Here,
local-dependent sorting seems like a plus, and the particular order is not
so interesting.

Thanks everyone!

—Rasmus

-- 
There are known knowns; there are things we know that we know




reply via email to

[Prev in Thread] Current Thread [Next in Thread]