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: Sat, 26 Nov 2022 02:03:43 +0000 Message-ID: <877czimpz4.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> <87ilj7dbms.fsf@localhost> <83sfib172p.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5310"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59275-done@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 26 03:04:21 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 1oykYG-0001BW-Aq for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 26 Nov 2022 03:04:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oykY7-0002RK-Dk; Fri, 25 Nov 2022 21:04:12 -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 1oykY0-0002Qt-Du for bug-gnu-emacs@gnu.org; Fri, 25 Nov 2022 21:04:04 -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 1oykXy-0007nf-8U for bug-gnu-emacs@gnu.org; Fri, 25 Nov 2022 21:04:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oykXy-0004LQ-4A for bug-gnu-emacs@gnu.org; Fri, 25 Nov 2022 21:04: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: Sat, 26 Nov 2022 02:04: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-done@debbugs.gnu.org id=D59275.166942819716646 (code D ref 59275); Sat, 26 Nov 2022 02:04:02 +0000 Original-Received: (at 59275-done) by debbugs.gnu.org; 26 Nov 2022 02:03:17 +0000 Original-Received: from localhost ([127.0.0.1]:37504 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oykXE-0004KQ-RJ for submit@debbugs.gnu.org; Fri, 25 Nov 2022 21:03:17 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:43209) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oykXC-0004KA-E2 for 59275-done@debbugs.gnu.org; Fri, 25 Nov 2022 21:03:15 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 622F2240026 for <59275-done@debbugs.gnu.org>; Sat, 26 Nov 2022 03:03:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1669428188; bh=RekQwok0c7maSVMx1b3K3esIFAeLUUXOjsulqZ8dHOs=; h=From:To:Cc:Subject:Date:From; b=Ji4DnQZqNIkoJqQTUg3FDPivdMaey0MOrXC/lOj7vPYuhpGRDANkQJgA3H/LUmubs FkoNjH2NJ+gNBIfDvR4aJGKnrvq6AXKgh0m9BXoAm//CqB20uOWpyTDvvxUWcq2nRs m27zi3565vN1Ai+7BTVEjmD38wkCaJDGZMgkbeVLaUXbqoxcK9sj0oEPB+F6Gp7IPf HueCGe79mAT4cyRJEarGMIaFXSb8LWl3cnEu3czCrx0mDxV3GEUNMtnnaGnlpfuQZM zUe8T3xcgs2cbbCK4GbZiYOkqKa9lfpxug2kXchDrmnNFrZk+tw6EYbSUMWl29djmf QALmUvczCqWwg== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4NJw4B6WdWz6tm9; Sat, 26 Nov 2022 03:03:03 +0100 (CET) In-Reply-To: <83sfib172p.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:249032 Archived-At: Eli Zaretskii writes: >> We use string collation for >>=20 >> 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) >>=20 >> 1-6 should follow the locale. > > I think only 1 and 6 are firmly in that category. For the others it depe= nds > 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. 1-6 are for interactive use. As Maxim pointed out in https://orgmode.org/list/tlle59$pl3$1@ciao.gmane.io, `string-collate-lessp' generally yield better results for human consumption: " (setq lst '("semana" "se=C3=B1or" "sepia")) (sort lst #'string-lessp) ; =3D> ("semana" "sepia" "se=C3=B1or") (sort lst #'string-collate-lessp) ; =3D> ("semana" "se=C3=B1or" "sepia") " In the same thread, we also discussed what Org can do about MacOS and other systems that do not implement string collation. We concluded that a better fallback when collation is not available would be using downcase+string-lessp when `string-collate-lessp' is called with non-nil IGNORE-CASE argument. Would it be acceptable for Emacs to change the fallback behavior of `string-collate-lessp' to: 1. If string collation is not available and IGNORE-CASE is nil, fallback to`string-lessp'; 2. If string collation is not available and IGNORE-CASE is non-nil, use `downcase' + `string-lessp'. This will not compromise consistency and will yield slightly better fallback results. I also do not think that it will be backwards-incompatible. If the call to `string-collate-lessp' explicitly requests ignoring case, `downcase' is more expected than bare `string-lessp' that _does not_ ignore case. WDYT? --=20 Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at