On 21/04/2021 03:37, Nicolas Goaziou wrote: > Maxim Nikulin writes: > >> (let ((s (org-sort-remove-invisible >> "A wrapping [[https://orgmode.org?a=b&c=d#e][link]] emphasis/" >> >> I expect "A wrapping link emphasis". > > Yet, your expectations are wrong. There is no link in the text above. > Emphasized text starts at "/wrapping" and ends before "/?". > > Granted, this is a situation where the Org syntax is not very intuitive. > Anyway, the new function is more accurate. I think, new variant should be committed even it does not fix Juan's case. He have not confirmed the fix yet. > Maybe we should require a space after punctuation following emphasized > text. I don't know. This is orthogonal to the current discussion. I still believe in my expectation, however I admit such limitation of parser. At first I have not recognized that the issue may be similar to https://orgmode.org/list/CAH+Wm4-_XHUZKFTf=ZtbfnCPvQWkbEoeGs8EpYm+8SPmu8LHFg@mail.gmail.com/ Anyway for my example workaround is to add more markers before, inside, and after the link. Maybe I will look closer at Tom's parser if it solves ambiguity in the same way. >> In the meanwhile I have tried >> >> (benchmark-run 1 (org-sort-list t ?a)) >> >> in a file (1100 lines) obtained using > > I don't think performance is really an issue. Of course, the suggested > function is clearly slower than the current one. It is OK since difference is not really huge, especially taking into account that new variant was not compiled. Do you still have problem with locale dependency of added tests? I can not guess what could be its source and expect that test should work reliably. Disregard "/3" in the subject of the patches. Third change is your code.