From: Michael Brand <michael.ch.brand@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: Max Nikulin <manikulin@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: test-org-table/sort-lines: Failing test on macOS
Date: Mon, 6 Jan 2025 21:49:11 +0100 [thread overview]
Message-ID: <CALn3zoh2EBQyt4X3oy4KX_8xga-BaNGyz1X6wv+BU5_V9Dw2JQ@mail.gmail.com> (raw)
In-Reply-To: <87a5c3hjko.fsf@localhost>
On Mon, Jan 6, 2025 at 7:38 PM Ihor Radchenko <yantar92@posteo.net> wrote:
> There was a transient problem on main. Now, make test should run.
Now I see, fixed a few minutes before my post, thank you. This reveals
that the test failure discussed here is the same on main as on bugfix.
In the following I will use the term "bifurcation" as short for: Using
~(string-collate-lessp "a" "B" nil t)~ for the purpose of telling
whether the parameter to ignore case has an effect on
~string-collate-lessp~ or not and to choose the right expected test
result (the currently implemented case-insensitive or the to be added
case-sensitive) for a test result involving ~string-collate-lessp~.
> AFAIU, this is more complex.
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59275 looks complicated
to me too, but just the very narrow sub-subject of bifurcation seems
quite simple to me and I don't agree.
> We cannot have a simple test for all possible locales.
Why is bifurcation not doing it?
> Or did you find one?
To my understanding it is bifurcation.
> My conclusion from bug#59275 discussion is that simple tries like
> (string-collate-lessp "a" "B" locale t)
> will not work.
I have read a large part of bug#59275 but missed what you mean by will
not work. Probably not work for this and that, but for the purpose of
just bifurcation I expect ~(string-collate-lessp "a" "B" null t)~ to
be sufficient.
> Especially for non-US locales.
I expect bifurcation to work with _any_ existing or future locale.
~(org-test-string-collate-lessp-ignore-case-supported-p)~ simply
measures whether the parameter for ignore case of
~string-collate-lessp~ has an effect in the locale of the current
scope, in any locale, libc etc., regardless of how complicated their
impact on this matter is. Although it is not necessary for bifurcation
alone, the locale in the scope of
#+begin_src emacs-lisp
;; Sort alphabetically. Enforce the C locale for consistent results.
(let ((original-string-collate-lessp (symbol-function 'string-collate-lessp)))
(cl-letf (((symbol-function 'string-collate-lessp)
(lambda (s1 s2 &optional _locale ignore-case)
(funcall original-string-collate-lessp
s1 s2 "C" ignore-case))))
#+end_src
in test-org-table/sort-lines is even clearly defined and a very well
known and simple one.
I don't have any concern about bifurcation. I would even go further
and suspect that my patch not just fixes the tests but (as a side
effect, not as my goal) obsoletes the current "Enforce the C locale
for consistent results". My patch _neutralizes_ the ignore case
behavior of ~string-collate-lessp~. Contrary, the current
implementation tries to _fixate_ at least the ignore case behavior of
~string-collate-lessp~ which is not possible for some cases according
to its docstring.
next prev parent reply other threads:[~2025-01-06 20:50 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-06 20:15 test-org-table/sort-lines: Failing test on macOS Rudolf Adamkovič
2022-10-07 12:04 ` Max Nikulin
2022-10-08 5:25 ` Ihor Radchenko
2022-10-08 14:27 ` Max Nikulin
2022-10-09 3:59 ` Ihor Radchenko
2022-10-09 15:38 ` Rudolf Adamkovič
2022-10-09 16:53 ` Max Nikulin
2022-10-10 22:25 ` Rudolf Adamkovič
2022-10-12 16:09 ` Max Nikulin
2022-11-15 4:10 ` Ihor Radchenko
2022-11-20 4:18 ` Ihor Radchenko
2022-11-20 8:00 ` Max Nikulin
2022-11-21 3:15 ` Ihor Radchenko
2022-11-21 16:48 ` Max Nikulin
2022-11-22 1:14 ` Ihor Radchenko
2022-11-22 16:01 ` Max Nikulin
2022-11-23 10:37 ` Ihor Radchenko
2022-11-23 15:27 ` Max Nikulin
2022-11-23 17:01 ` Max Nikulin
2022-11-26 2:05 ` Ihor Radchenko
2022-11-29 16:40 ` Max Nikulin
2024-04-03 11:40 ` [DISCUSSION] Sorting strings in Org mode vs. system locale (was: test-org-table/sort-lines: Failing test on macOS) Ihor Radchenko
2024-05-05 11:59 ` Ihor Radchenko
2024-05-07 11:06 ` [DISCUSSION] Sorting strings in Org mode vs. system locale Max Nikulin
2024-05-07 13:09 ` Ihor Radchenko
2024-05-07 16:47 ` Max Nikulin
2024-05-11 9:38 ` Ihor Radchenko
2025-01-06 18:22 ` test-org-table/sort-lines: Failing test on macOS Michael Brand
2025-01-06 18:40 ` Ihor Radchenko
2025-01-06 20:49 ` Michael Brand [this message]
2025-01-08 16:49 ` Michael Brand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CALn3zoh2EBQyt4X3oy4KX_8xga-BaNGyz1X6wv+BU5_V9Dw2JQ@mail.gmail.com \
--to=michael.ch.brand@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=manikulin@gmail.com \
--cc=yantar92@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).