I can reproduce the issue with emacs-27.1 from ubuntu-21.04 beta live image running in qemu. Org mode is current git HEAD. It seems that something is changed in emacs since locale is correct:

ubuntu@ubuntu:~$ printf '%s- v\n- /v/\n- a\n- /a/\n' '' \
  | LANG=C.UTF-8 sort
- /a/
- /v/
- a
- v
ubuntu@ubuntu:~$ printf '%s- v\n- /v/\n- a\n- /a/\n' '' \
  | LANG=es_ES.UTF-8 sort
- /a/
- a
- /v/
- v

Concerning org-sort-list, I do not see any problem with en_US.UTF-8, it_IT.UTF-8, and ru_RU.UTF-8 locales. However emphasized items are sorted first for at least es_ES.UTF-8, es_MX.UTF-8, and es_US.UTF-8.
I have found some evidence that the problem is on the org side

cat list.el
(message "%S" (sort '("- /v/" "- v" "- a" "- /a/")
                    #'string-collate-lessp))

LC_ALL=C.UTF-8 emacs --batch -Q -l list.el
("- /a/" "- /v/" "- a" "- v")

LC_ALL=en_US.UTF-8 emacs --batch -Q -l list.el
("- /a/" "- a" "- /v/" "- v")

LC_ALL=es_ES.UTF-8 emacs --batch -Q -l list.el
("- /a/" "- a" "- /v/" "- v")

So even string-collate-lessp works as expected.

I'm puzzled why the problem is specific to org-sort-list and namely to Spanish locales.


Reply via email to