On 21/04/2021 22:45, Juan Manuel Macías wrote:

I have tried the Nicolas' patch (latest version) and I see that the
items with emphasis are already ordered well. However, it seems that the
problem with identical items with or without emphasis still persists:
which items should go before and in what order? For example, in the
following list I get:

- /a/
- *a*
- a
- *b*
- /b/
- b
- /v/
- *v*
- v

I am afraid, there is no easy way to take into account emphasis. Each item have to be split into logical units and locale-aware multilevel comparison should be applied to each unit separately. E.g. for description list, only term should be compared at first to properly order emphasized items, it does not matter if description starts from "a" or from "z". Simple `string-collate-lessp' for whole item uses further levels only strings are considered identical on previous levels. I had an idea to augment sort keys with some text properties for custom string comparator, but I decided that such complications would not ensure reliable sort for all possible cases.

- A :: B
- /A/ :: C
- *A* :: A

However `org-sort-remove invisible' still has some room for improvements (it is not mandatory in my opinion). I have realized it reading the thread on title representation for HTML export
https://orgmode.org/list/87h7jy4ebe....@nicolasgoaziou.fr/

- <<target>>A
- <<<radio>>>
- B


Reply via email to