|
From: | Max Nikulin |
Subject: | Re: [DISCUSSION] Sorting strings in Org mode vs. system locale |
Date: | Tue, 7 May 2024 23:47:26 +0700 |
User-agent: | Mozilla Thunderbird |
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.
[Prev in Thread] | Current Thread | [Next in Thread] |