emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: test-org-table/sort-lines: Failing test on macOS


From: Ihor Radchenko
Subject: Re: test-org-table/sort-lines: Failing test on macOS
Date: Tue, 22 Nov 2022 01:14:21 +0000

Max Nikulin <manikulin@gmail.com> writes:

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

`downcase' is used to determine user input about sorting type.
Not for sorting itself.

>> 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.

I feel like we are slightly miscommunicating here.
I mostly tried to list the uses of libc-sensitive sorting. Not
specifically cases when we try to ignore the case.

The problem is not limited to case-sensitive comparisons. Some systems
may fail to implement specific locales and thus sorting may downgrade to
simple string-lessp.

No `downcase' is hidden anywhere there.

>> 6. Agenda sorting, when alphabetical sorting is involved
>
> `string-lessp' and `downcase' so even more severe locale-related issues 
> might be expected.

Could you please elaborate?

>> 7. `org-map-entries'
>
> Unsure which predicate is used.

It is a similar scenario with agenda. `org-map-entries' uses
`org-make-tags-matcher', which calls `org-op-to-function' when user
wants to select property values via </<=/>/>= criterion.
`org-op-to-function' calls `org-string<' or similar that, in turn, uses
`string-collate-lessp' with nil IGNORE-CASE argument.

>> 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.

Sounds reasonable.

>>> 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)

Thanks!

>> 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.

Well. Just using `string-lessp' would make things very consistent.
Easily and with no efforts.

The question though is what is the right thing to do for users while
also keeping consistency.

-- 
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>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]