From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.bugs Subject: bug#59275: Unexpected return value of `string-collate-lessp' on Mac Date: Tue, 22 Nov 2022 01:24:43 +0000 Message-ID: <87ilj7dbms.fsf@localhost> References: <87zgcsdfma.fsf@localhost> <83iljgib4w.fsf@gnu.org> <87h6z0cl6b.fsf@localhost> <837czwi6yp.fsf@gnu.org> <8735ajel7y.fsf@localhost> <83mt8rgill.fsf@gnu.org> <877czokbpk.fsf@localhost> <8335ac4eo5.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7036"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59275@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 22 02:25:18 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oxI2E-0001bj-SS for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 22 Nov 2022 02:25:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oxI24-0000PP-6z; Mon, 21 Nov 2022 20:25:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oxI22-0000PG-RM for bug-gnu-emacs@gnu.org; Mon, 21 Nov 2022 20:25:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oxI22-0000QN-ID for bug-gnu-emacs@gnu.org; Mon, 21 Nov 2022 20:25:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oxI22-0006sk-5R for bug-gnu-emacs@gnu.org; Mon, 21 Nov 2022 20:25:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 22 Nov 2022 01:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59275 X-GNU-PR-Package: emacs Original-Received: via spool by 59275-submit@debbugs.gnu.org id=B59275.166908025426398 (code B ref 59275); Tue, 22 Nov 2022 01:25:02 +0000 Original-Received: (at 59275) by debbugs.gnu.org; 22 Nov 2022 01:24:14 +0000 Original-Received: from localhost ([127.0.0.1]:49191 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oxI1G-0006rh-0F for submit@debbugs.gnu.org; Mon, 21 Nov 2022 20:24:14 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:43231) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oxI1A-0006rQ-Nr for 59275@debbugs.gnu.org; Mon, 21 Nov 2022 20:24:12 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id AFF09240026 for <59275@debbugs.gnu.org>; Tue, 22 Nov 2022 02:24:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1669080242; bh=mbCRgYcQC9C75aGIgNLBPhB+ueYaEK+LJMYJVk63c20=; h=From:To:Cc:Subject:Date:From; b=WKi0CwEXwlVRq19ixv1IaR20FlP9nOR1ZE93I/Ds6hBKWFIP8OHm7nidAdrW6qFXa 914yejIiJuYIJe4exEVO5DDEC2LJ8w1lSg50Hg47CIJktPMWa6TEA4I/OJyop8k6tE kMSqG8pmX6/erj1kTgn7OZyO6sbxvnv4Q7gtQ4MOr4xA/ZtZwtz2m9nO9RyCTduBb4 5E00CtSbLQ5rhm+3xiV5JI9mLyrF19KId6S8idwt+NfUb9P0pj1Sd8NgbLc3rrRH3Q hpoZtEPzZQMNb7Hhx20BVQ+ibbFaqWDlvJFOIbDSEL9R8IamebDRD/SX+Nsr4WF+KE 9frpjwm4gwbag== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4NGRNx13ZJz9rxH; Tue, 22 Nov 2022 02:24:00 +0100 (CET) In-Reply-To: <8335ac4eo5.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:248587 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii 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. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-src-fns.c-Fstring_collate_lessp-Clarify-docstring.patch >From d9a67e94547ffeb6d8ac8a1202434fff1117af3f Mon Sep 17 00:00:00 2001 Message-Id: From: Ihor Radchenko 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 --=-=-= Content-Type: text/plain -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at --=-=-=--