emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Max Nikulin <manikulin@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: [DISCUSSION] Sorting strings in Org mode vs. system locale (was: test-org-table/sort-lines: Failing test on macOS)
Date: Wed, 03 Apr 2024 11:40:19 +0000	[thread overview]
Message-ID: <87jzleptcs.fsf@localhost> (raw)
In-Reply-To: <tm5cmp$8kv$1@ciao.gmane.io>

Max Nikulin <manikulin@gmail.com> writes:

>> This sounds like something to be adapted to Emacs upstream.
>> I suggested to change `string-collate-lessp' fallback behaviour to use
>> `downcase' when IGNORE-CASE is non-nil. See my last message in
>> bug#59275.
>
> I do not share Eli's position "all or nothing". I prefer graceful 
> degradation and best result achievable with reasonable efforts.

> However either the reason is performance or correctness, both variants 
> are against modification of `string-collate-lessp'. I still think that 
> Org will benefit from a compatibility wrapper with `downcase'.

Unless we have user complaints with real-world use-cases, I am leaning
towards keeping things consistent with Emacs. Including Emacs-wide
fallback for `string-collate-lessp'. This will make our life easier.

Maintaining an Org-specific fallback will (1) cost maintenance time; (2)
may confuse users used to global Emacs behaviour; (3) has no clear
benefit other than our theoretical discussion.

> The only additional consideration is that compare function should be 
> configurable. If a user access same files from Linux and macOS then it 
> may be really annoying to get different order of entries in agenda. For 
> most of Linux users it is better to use more smart 
> `string-collate-lessp'. Some care is required to sort entries obtained 
> from multiple buffers in predictable environment (locale, case 
> conversion table).

I agree. We can introduce a new customization -
`org-string-sort-function' that will be used across Org mode to sort
user text.

It would be even better to allow smart sort function that depends on
document #+language, but I do not see an easy way to implement such
feature - `string-collate-lessp' does accept LOCALE argument, but I have
no idea how to link #+LANGUAGE to locale deterministically.

-- 
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>


  reply	other threads:[~2024-04-03 11:41 UTC|newest]

Thread overview: 27+ 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                                       ` Ihor Radchenko [this message]
2024-05-05 11:59                                         ` [DISCUSSION] Sorting strings in Org mode vs. system locale (was: test-org-table/sort-lines: Failing test on macOS) 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

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=87jzleptcs.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=manikulin@gmail.com \
    /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).