emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Patch] to correctly sort the items with emphasis marks in a list


From: Maxim Nikulin
Subject: Re: [Patch] to correctly sort the items with emphasis marks in a list
Date: Sat, 24 Apr 2021 21:41:55 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1

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
87h7jy4ebe.fsf@nicolasgoaziou.fr/">https://orgmode.org/list/87h7jy4ebe.fsf@nicolasgoaziou.fr/

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




reply via email to

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