Subject: bug#59275: Unexpected return value of `string-collate-lessp' on Mac

From: Ihor Radchenko <[email-masked]>
Date: Mon, 21 Nov 2022 07:28:55 +0000

Eli Zaretskii <[email-masked]> 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.

>> I'd like the warning to be even more prominent.
>
> You want to make it explicit that for systems where we use
> string-lessp the IGNORE-CASE argument is ignored?  Or do you want some
> other change?

Yes, I think.

> Anyway, feel free to suggest some text to that effect.

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.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>