[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#59275: Unexpected return value of `string-collate-lessp' on Mac
From: |
Ihor Radchenko |
Subject: |
bug#59275: Unexpected return value of `string-collate-lessp' on Mac |
Date: |
Tue, 22 Nov 2022 01:24:43 +0000 |
Eli Zaretskii <eliz@gnu.org> writes:
>> > 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.
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 we had a bug report in the past
where a user got confusing about list sorting being confusing for the
user language conventions.
7 is more debatable.
>> 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.
See the attached patch.
>From d9a67e94547ffeb6d8ac8a1202434fff1117af3f Mon Sep 17 00:00:00 2001
Message-Id:
<d9a67e94547ffeb6d8ac8a1202434fff1117af3f.1669080246.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Tue, 22 Nov 2022 09:21:17 +0800
Subject: [PATCH] * src/fns.c (Fstring_collate_lessp): Clarify docstring
Clarify that IGNORE-CASE argument might be ignored when the operation
system does not implement string collation for the specified locale.
See bug#59275.
---
src/fns.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/fns.c b/src/fns.c
index 035fa12935..e337c0958d 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -596,8 +596,9 @@ DEFUN ("string-collate-lessp", Fstring_collate_lessp,
Sstring_collate_lessp, 2,
bind `w32-collate-ignore-punctuation' to a non-nil value, since
the codeset part of the locale cannot be \"UTF-8\" on MS-Windows.
-If your system does not support a locale environment, this function
-behaves like `string-lessp'. */)
+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. */)
(Lisp_Object s1, Lisp_Object s2, Lisp_Object locale, Lisp_Object ignore_case)
{
#if defined __STDC_ISO_10646__ || defined WINDOWSNT
--
2.35.1
--
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>
- bug#59275: Unexpected return value of `string-collate-lessp' on Mac, Ihor Radchenko, 2022/11/14
- bug#59275: Unexpected return value of `string-collate-lessp' on Mac, Robert Pluim, 2022/11/15
- bug#59275: Unexpected return value of `string-collate-lessp' on Mac, Eli Zaretskii, 2022/11/15
- bug#59275: Unexpected return value of `string-collate-lessp' on Mac, Ihor Radchenko, 2022/11/15
- bug#59275: Unexpected return value of `string-collate-lessp' on Mac, Eli Zaretskii, 2022/11/15
- bug#59275: Unexpected return value of `string-collate-lessp' on Mac, Ihor Radchenko, 2022/11/15
- bug#59275: Unexpected return value of `string-collate-lessp' on Mac, Eli Zaretskii, 2022/11/16
- bug#59275: Unexpected return value of `string-collate-lessp' on Mac, Ihor Radchenko, 2022/11/21
- bug#59275: Unexpected return value of `string-collate-lessp' on Mac, Eli Zaretskii, 2022/11/21
- bug#59275: Unexpected return value of `string-collate-lessp' on Mac,
Ihor Radchenko <=
- bug#59275: Unexpected return value of `string-collate-lessp' on Mac, Eli Zaretskii, 2022/11/22
- bug#59275: Unexpected return value of `string-collate-lessp' on Mac, Ihor Radchenko, 2022/11/23
- bug#59275: Unexpected return value of `string-collate-lessp' on Mac, Eli Zaretskii, 2022/11/23
- bug#59275: Unexpected return value of `string-collate-lessp' on Mac, Ihor Radchenko, 2022/11/23
- bug#59275: Unexpected return value of `string-collate-lessp' on Mac, Eli Zaretskii, 2022/11/24
- bug#59275: Unexpected return value of `string-collate-lessp' on Mac, Ihor Radchenko, 2022/11/25
- bug#59275: Unexpected return value of `string-collate-lessp' on Mac, Eli Zaretskii, 2022/11/26
- bug#59275: Unexpected return value of `string-collate-lessp' on Mac, Ihor Radchenko, 2022/11/26
- bug#59275: Unexpected return value of `string-collate-lessp' on Mac, Eli Zaretskii, 2022/11/26
- bug#59275: Unexpected return value of `string-collate-lessp' on Mac, Maxim Nikulin, 2022/11/27