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

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 22 Nov 2022 12:57:02 +0000

Your bug report

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

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
59275: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59275
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#59275: Unexpected return value of `string-collate-lessp' on Mac
From: Eli Zaretskii <[email-masked]>
To: Ihor Radchenko <[email-masked]>
Cc: [email-masked]
Date: Tue, 22 Nov 2022 14:56:14 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Ihor Radchenko <[email-masked]>
> Cc: [email-masked]
> 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.

Subject: Unexpected return value of `string-collate-lessp' on Mac
From: Ihor Radchenko <[email-masked]>
To: [email-masked]
Date: Tue, 15 Nov 2022 04:08:13 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

I am forwarding an issue originally reported on Org mailing list.
https://orgmode.org/list/[email-masked]

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>