emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: test-org-table/sort-lines: Failing test on macOS


From: Max Nikulin
Subject: Re: test-org-table/sort-lines: Failing test on macOS
Date: Fri, 7 Oct 2022 19:04:19 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0

On 07/10/2022 03:15, Rudolf Adamkovič wrote:

If I understand, "a" should be less than "B" when under "C" locale when
ignoring case (nil) , right?  Yet, I get the following:

(string-collate-lessp "a" "B" "C" nil)  ; => nil

When case is not ignored (4th argument is nil) locale-dependent collation rules are used, so you get the expected result.

$ printf 'a\nB\n' | LC_COLLATE=C sort
B
a
$ printf 'a\nB\n' | LC_COLLATE=en_US.UTF-8 sort
a
B

[FYI: If I replace nil with t, the procedure returns nil too.]

Tested on Emacs 29 (adaa2fc90e) and Org 9.5.5 (580f28614).

Strange. Emacs-26, Linux

(string-collate-lessp "a" "B" "C" t)
t

If libc is sane (assuming that sort is linked to the same libc)

printf 'a\nb\n' | LC_COLLATE=C sort
printf 'b\na\n' | LC_COLLATE=C sort
printf 'A\nB\n' | LC_COLLATE=C sort
printf 'B\nA\n' | LC_COLLATE=C sort
printf 'a\nb\n' | LC_COLLATE=C.UTF-8 sort
printf 'b\na\n' | LC_COLLATE=C.UTF-8 sort
printf 'A\nB\n' | LC_COLLATE=C.UTF-8 sort
printf 'B\nA\n' | LC_COLLATE=C.UTF-8 sort

then you might face an Emacs bug.

P.S. Example of a subtle issue with sorting: significant space added to some locales like es_ES & Co, pl_PL:

Maxim Nikulin. Re: [Patch] to correctly sort the items with emphasis marks in a list. Fri, 16 Apr 2021 21:59:51 +0700. https://list.orgmode.org/s5c8p9$97n$1@ciao.gmane.io




reply via email to

[Prev in Thread] Current Thread [Next in Thread]