Fix alphabetic sorting for headlines, tags
commit551d2f1fe7ad797806ed51c63d45553ef1d6a777
authorSebastian Reuße <seb@wirrsal.net>
Mon, 12 Feb 2018 08:46:04 +0000 (12 09:46 +0100)
committerNicolas Goaziou <mail@nicolasgoaziou.fr>
Mon, 12 Feb 2018 13:57:54 +0000 (12 14:57 +0100)
treeb297199ce8f48a7e99ee089f5c2ac6077e88e377
parentb505a5b6ad9d12ddb3b3c9a73962eaf5e6a9fa41
Fix alphabetic sorting for headlines, tags

* org.el (org-sort-entries): Use collated sorting.
(org-tags-sort-function): Use collated sorting.
(org-string-collate-greaterp): Add helper-function to use as defcustom
option, since there is no ‘string-collate-greaterp’ in Emacs.

* org-compat.el (org-string-collate-lessp): Add proxy to fall-back on
string-lessp when string-collate-lessp is missing (Emacs ≤ 24).

* test-org.el (test-org/string-collate-lessp): Add test.
(test-org/sort-entries): Add regression test for non-ASCII inputs.

‘org-sort-entries’ and ‘org-tags-sort-function’ advertise alphabetic
sorting, but actually sort based only on character code.  This
produces non-alphabetic orderings of strings in non-ASCII locales.

E. g., German Umlauts “Ä Ü Ö” are alphabetically sorted as if they
were “A U O”, whereas sorting based on character-code will place them
after “Z”, which is unexpected.
etc/ORG-NEWS
lisp/org-compat.el
lisp/org.el
testing/lisp/test-org.el