emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Max Nikulin <manikulin@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: test-org-table/sort-lines: Failing test on macOS
Date: Mon, 21 Nov 2022 23:48:27 +0700	[thread overview]
Message-ID: <tlga4s$ajm$1@ciao.gmane.io> (raw)
In-Reply-To: <87k03pj8vw.fsf@localhost>

On 21/11/2022 10:15, Ihor Radchenko wrote:
> Max Nikulin writes:
>>> However, I am not sure if ignoring locale is something we really want.
>>> WDYT?
>> I think we should keep `string-collate-lessp' in the
>> `org-table-sort-lines' implementation. Users expect sorting accordingly
>> to their locales. However it is better to add a warning to
>> `org-table-sort-lines' docstring and to the manual that caseless sort
>> depends on its implementation in libc, so currently it does not work in
>> clang/llvm and so e.g. on MacOS.
> Sounds reasonable.
> Note that not only `org-table-sort-lines' is using
> `string-collate-lessp'. The full list of functions potentially affected
> by libc sorting is:
> 1. Bibliography order in `org-cite-basic-export-bibliography'
>     (via org-cite-basic--sort-keys -> org-cite-basic--field-less-p)
 > 3. `org-table-sort-lines'

> 2. `org-sort-list'
> 5. `org-sort-entries'
`downcase' is used, not proper case folding, so a potential issue

> 4. `org-set-tags' (tag order), when `org-tags-sort-function' is set to
>     "Alphabetical" or "Reverse alphabetical".

IGNORE-CASE argument is not used, perhaps `downcase' is hidden in the code.

> 6. Agenda sorting, when alphabetical sorting is involved

`string-lessp' and `downcase' so even more severe locale-related issues 
might be expected.

> 7. `org-map-entries'

Unsure which predicate is used.

> I am not 100% sure where we should add the information to
> docstring/manual and where we should not.

If footnotes in the manual had fixed labels then I would suggest 
reference the same footnote in the manual and in the docstrings. 
Perhaps, a new subsection should be added to info "(org) Miscellaneous" 
and "see info node ..." should be added to all involved docstrings.

>> Concerning the test, I would split the current testcase into 2 parts
>> depending on WITH-CASE argument, check if caseless collation is
>> available and skip the related test otherwise.
> How can we check the availability?

(string-collate-lessp "a" "B" "C" t)

> Indeed. Also, see https://nullprogram.com/blog/2014/06/13/. However,
> what we are concerned about here is consistency. Not the pitfalls per
> se.

Achieving consistency across Org code requires additional efforts.

  reply	other threads:[~2022-11-21 16:49 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-06 20:15 test-org-table/sort-lines: Failing test on macOS Rudolf Adamkovič
2022-10-07 12:04 ` Max Nikulin
2022-10-08  5:25   ` Ihor Radchenko
2022-10-08 14:27     ` Max Nikulin
2022-10-09  3:59       ` Ihor Radchenko
2022-10-09 15:38         ` Rudolf Adamkovič
2022-10-09 16:53           ` Max Nikulin
2022-10-10 22:25             ` Rudolf Adamkovič
2022-10-12 16:09               ` Max Nikulin
2022-11-15  4:10                 ` Ihor Radchenko
2022-11-20  4:18                   ` Ihor Radchenko
2022-11-20  8:00                     ` Max Nikulin
2022-11-21  3:15                       ` Ihor Radchenko
2022-11-21 16:48                         ` Max Nikulin [this message]
2022-11-22  1:14                           ` Ihor Radchenko
2022-11-22 16:01                             ` Max Nikulin
2022-11-23 10:37                               ` Ihor Radchenko
2022-11-23 15:27                                 ` Max Nikulin
2022-11-23 17:01                                   ` Max Nikulin
2022-11-26  2:05                                   ` Ihor Radchenko
2022-11-29 16:40                                     ` Max Nikulin
2024-04-03 11:40                                       ` [DISCUSSION] Sorting strings in Org mode vs. system locale (was: test-org-table/sort-lines: Failing test on macOS) Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='tlga4s$ajm$1@ciao.gmane.io' \
    --to=manikulin@gmail.com \
    --cc=emacs-orgmode@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).