[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [DISCUSSION] Sorting strings in Org mode vs. system locale
From: |
Ihor Radchenko |
Subject: |
Re: [DISCUSSION] Sorting strings in Org mode vs. system locale |
Date: |
Tue, 07 May 2024 13:09:23 +0000 |
Max Nikulin <manikulin@gmail.com> 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'.
> (defcustom org-sort-function
> (if (string-collate-lessp "a" "B" "C" t)
> #'string-collate-lessp
> #'org-sort-function-fallback-downcase))
No. Let's be consistent with Emacs here.
> 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.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>