--- Begin Message ---
Subject: |
Unexpected return value of `string-collate-lessp' on Mac |
Date: |
Tue, 15 Nov 2022 04:08:13 +0000 |
Hi,
I am forwarding an issue originally reported on Org mailing list.
https://orgmode.org/list/m2ilkwso8r.fsf@me.com
On Emacs 29 (adaa2fc90e) MacOS build:
(string-collate-lessp "a" "B" "C" t) ; => nil
On Linux:
(string-collate-lessp "a" "B" "C" t) ; => t
The return value on MacOS is unexpected.
See more information, including locale date, in the Org ML thread.
--
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>
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#59275: Unexpected return value of `string-collate-lessp' on Mac |
Date: |
Tue, 22 Nov 2022 14:56:14 +0200 |
> From: Ihor Radchenko <yantar92@posteo.net>
> Cc: 59275@debbugs.gnu.org
> Date: Tue, 22 Nov 2022 01:24:43 +0000
>
> > 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.
>
> We use string collation for
>
> 1. Sorting bibliographies
> 2. Sorting lists
> 3. Sorting table lines
> 4. Sorting tags
> 5. Sorting headings
> 6. Sorting entries in agendas
> 7. As a criterion for agenda/tag filtering when comparison operator is
> used on string property values (11.3.3 Matching tags and properties)
>
> 1-6 should follow the locale.
I think only 1 and 6 are firmly in that category. For the others it depends
on whether the results of the sorting are immediately displayed, or used for
further processing. In the former case, using string-collate-lessp is
semi-okay ("semi" because producing different results in different locales
can still confuse users); in the latter case it is wrong, IMO, because you
will cause unexpected results.
> See the attached patch.
Thanks, installed.
--- End Message ---