On 07/05/2024 20:09, Ihor Radchenko wrote:
Max Nikulin writes:
I consider the following as a kind of graceful degradation
(defun org-sort-function-fallback-downcase
(a b &optional LOCALE IGNORE-CASE)
(if ignore-case
(string-collate-lessp (downcase a) (downcase b) locale ignore-case)
(string-collate-lessp a b locale ignore-case)))
It is indeed better than `org-sort-function-downcase'.
`compare-strings' with upcase conversion under the hood may be an
alternative.
I would consider a setter function for `org-sort-function' to avoid
branches based of `func-arity' in `org-string<'.
Setter is not reliable when setq is used, so I prefer arity check.
I bothers me as well. Another idea is to require 2 optional argument and
thus wrappers for 2 argument functions. My expectation that extra
function call still may be cheaper.