GNU bug report logs - #59275
Unexpected return value of `string-collate-lessp' on Mac

Previous Next

Package: emacs;

Reported by: Ihor Radchenko <yantar92 <at> posteo.net>

Date: Tue, 15 Nov 2022 04:08:02 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #32 received at 59275 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: 59275 <at> debbugs.gnu.org
Subject: Re: bug#59275: Unexpected return value of `string-collate-lessp' on
 Mac
Date: Mon, 21 Nov 2022 15:31:38 +0200
> From: Ihor Radchenko <yantar92 <at> posteo.net>
> Cc: 59275 <at> debbugs.gnu.org
> Date: Mon, 21 Nov 2022 07:28:55 +0000
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> >> Reliable sorting.
> >> In particular, I am looking for a better PREDICATE argument for
> >> `sort-subr' for case-sensitive and case-insensitive sorting of strings.
> >
> > In the strict order of Unicode codepoints?  Use compare-strings.
> 
> Thanks for the clarification.
> After further considerations, it looks like we should still use
> `string-collate-lessp' on Org side as it yields expected results if libc
> properly implements the collation.

Is the feature that uses it intended to be used only on glibc platforms
(which basically means GNU/Linux)?  If not, I'm surprised that you arrived
at this conclusion.  It is the 180 deg opposite of what I think you should
have decided.

Once again: locale-specific collation order is inherently unpredictable in
its results, and should only be used when the locale-specific order is a
_must_, like when sorting people's names for a telephone directory.

> Maybe change
> 
>   If your system does not support a locale environment, this function
>   behaves like `string-lessp'.
> 
> to
> 
>   Some operating systems do not implement correct collation (in specific
>   locale environments or at all). Then, this functions falls back to
>   case-sensitive `string-lessp' and IGNORE-CASE argument is ignored.

Fine with me.




This bug report was last modified 2 years and 176 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.