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


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#59275: closed (Unexpected return value of `string-collate-lessp'
 on Mac )
Date: Tue, 22 Nov 2022 12:57:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Tue, 22 Nov 2022 14:56:14 +0200
with message-id <83sfib172p.fsf <at> gnu.org>
and subject line Re: bug#59275: Unexpected return value of `string-collate-lessp' on Mac
has caused the debbugs.gnu.org bug report #59275,
regarding Unexpected return value of `string-collate-lessp' on Mac 
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
59275: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59275
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Ihor Radchenko <yantar92 <at> posteo.net>
To: bug-gnu-emacs <at> gnu.org
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 <at> 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>


[Message part 3 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: 59275-done <at> debbugs.gnu.org
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 <at> posteo.net>
> Cc: 59275 <at> 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.


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.