Max Nikulin <maniku...@gmail.com> 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) 2. `org-sort-list' 3. `org-table-sort-lines' 4. `org-set-tags' (tag order), when `org-tags-sort-function' is set to "Alphabetical" or "Reverse alphabetical". 5. `org-sort-entries' 6. Agenda sorting, when alphabetical sorting is involved 7. `org-map-entries' I am not 100% sure where we should add the information to docstring/manual and where we should not. > 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? > As to the thread linked to the bug report > https://lists.gnu.org/archive/html/emacs-devel/2022-07/msg00940.html > "case-insensitive string comparison." Tue, 19 Jul 2022 13:27:50 -0400, > there is a link > https://stackoverflow.com/questions/319426/how-do-i-do-a-case-insensitive-string-comparison > unrelated to the issue, but comments and answers there describe a lot of > pitfalls and explain why string comparison ignoring case is not trivial. > (It is a Sisyphean task in some sense, I like the comment on 3 sigmas.) Indeed. Also, see https://nullprogram.com/blog/2014/06/13/. However, what we are concerned about here is consistency. Not the pitfalls per se. -- 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>