emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Maxim Nikulin <manikulin@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: [Patch] to correctly sort the items with emphasis marks in a list
Date: Fri, 16 Apr 2021 21:59:51 +0700	[thread overview]
Message-ID: <s5c8p9$97n$1@ciao.gmane.io> (raw)
In-Reply-To: <87fszrwgr1.fsf@posteo.net>

Hi Juan,

On 16/04/2021 01:21, you wrote:
> #+begin_src emacs-lisp :tangle list-var.el
>    (message "%S" (sort '("-\s\sv" "-\sv" "-\sa" "-\s\sa")
> 			#'string-collate-lessp))
> #+end_src
> 
> #+begin_src sh
> exec 2>&1
> LC_ALL=en_US.UTF-8 emacs --batch -Q -l list-var.el
> #+end_src
> 
> #+RESULTS:
> : -  a" "- a" "-  v" "- v
> 
> #+begin_src sh
> exec 2>&1
> LC_ALL=es_ES.UTF-8 emacs --batch -Q -l list-var.el
> #+end_src
> 
> #+RESULTS:
> : -  a" "-  v" "- a" "- v

You have managed to convince me that despite my first suspects the 
locale on your computer is correct. It is unexpectedly correct and it is 
more correct that most of locales in libc.

However I do not have opinion concerning you patch yet. I have not 
realized what is the proper way to sort list.

Space is significant. At least it may be. Only a few languages have got 
such fix, Spanish is among them 
https://sourceware.org/git/?p=glibc.git;a=blobdiff;f=localedata/locales/es_ES;h=aa919a26267fd6311b71d7aeb81655e55787b4df;hp=d17612f6726d0c098ac981e06f3702106540bb23;hb=159738548130d5ac4fe6178977e940ed5f8cfdc4;hpb=ce6636b06b67d6bb9b3d6927bf2a926b9b7478f5

Notice "collating-symbol <space>"

I have found example of sorting names in a language where woman surname 
usually have additional "a" in comparison to man surname.

printf "Ivanova Alla\nIvanov Adam\nIvanova Svetlana\n" \
   | LANG=pl_PL.UTF-8 sort
Ivanov Adam
Ivanova Alla
Ivanova Svetlana

es_ES behavior is just as the above example.

printf "Ivanova Alla\nIvanov Adam\nIvanova Svetlana\n" \
   | LANG=en_US.UTF-8 sort
Ivanova Alla
Ivanov Adam
Ivanova Svetlana

Ukrainian sort works better than Russian one with such example:

printf "Иванова Алла\nИванов Адам\nИванова Светлана\n" \
   | LANG=uk_UA.UTF-8 sort
Иванов Адам
Иванова Алла
Иванова Светлана

printf "Иванова Алла\nИванов Адам\nИванова Светлана\n" \
   | LANG=ru_RU.UTF-8 sort
Иванова Алла
Иванов Адам
Иванова Светлана

Man names are sorted first in such lists. Other cases might exist when 
significant space is undesired.

So sorting is tricky than I expected.



  reply	other threads:[~2021-04-16 15:00 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-02 18:15 Juan Manuel Macías
2021-04-09 22:28 ` Nicolas Goaziou
2021-04-10  0:01   ` Juan Manuel Macías
2021-04-10 10:19     ` Nicolas Goaziou
2021-04-10 11:41       ` Juan Manuel Macías
2021-04-13 17:31         ` Maxim Nikulin
2021-04-13 19:08           ` Juan Manuel Macías
2021-04-14 15:42             ` Maxim Nikulin
2021-04-14 15:51               ` Maxim Nikulin
2021-04-14 17:07               ` Juan Manuel Macías
2021-04-14 21:36                 ` Juan Manuel Macías
2021-04-15 14:58                 ` Maxim Nikulin
2021-04-15 18:21                   ` Juan Manuel Macías
2021-04-16 14:59                     ` Maxim Nikulin [this message]
2021-04-16 15:30                       ` Maxim Nikulin
2021-04-17 13:27     ` Maxim Nikulin
2021-04-18 17:52       ` Juan Manuel Macías
2021-04-18 21:20         ` Juan Manuel Macías
2021-04-19  8:33           ` Nicolas Goaziou
2021-04-19 12:34             ` Maxim Nikulin
2021-04-19 16:08               ` Nicolas Goaziou
2021-04-19 17:00                 ` Greg Minshall
2021-04-19 17:17                   ` Tom Gillespie
2021-04-19 18:00                     ` Greg Minshall
2021-04-19 17:36                 ` Maxim Nikulin
2021-04-19 17:50                   ` Nicolas Goaziou
2021-04-20 12:37                     ` Maxim Nikulin
2021-04-20 12:20                 ` Maxim Nikulin
2021-04-20 13:57                   ` Nicolas Goaziou
2021-04-20 15:51                     ` Maxim Nikulin
2021-04-20 20:37                       ` Nicolas Goaziou
2021-04-21 13:10                         ` Maxim Nikulin
2021-04-21 15:45                           ` Juan Manuel Macías
2021-04-24 14:41                             ` Maxim Nikulin
2021-05-20 17:06                           ` [Patch] tests for org-remove-invisible Maxim Nikulin
2021-05-20 18:06                             ` Nicolas Goaziou
2021-09-27 16:53                               ` Max Nikulin
2021-11-25 12:11                           ` [Patch] to correctly sort the items with emphasis marks in a list Ihor Radchenko
2021-11-25 16:59                             ` Max Nikulin
2021-05-15 20:43                     ` Bastien
2021-05-15 22:09                       ` Nicolas Goaziou
2021-05-16  6:04                         ` Bastien
2021-04-28  5:46     ` Bastien
2021-04-28  6:37       ` Nicolas Goaziou
2021-04-28  6:49         ` Bastien
2021-04-28  8:04           ` Bastien
2021-05-15 13:32             ` Bastien
2021-05-15 15:10               ` Maxim Nikulin
2021-05-15 20:44                 ` Bastien
2021-04-12 13:50 Juan Manuel Macías
     [not found] <mailman.57.1618243212.17744.emacs-orgmode@gnu.org>
2021-04-12 18:51 ` Ypo
2021-04-12 23:18   ` Juan Manuel Macías
2021-04-12 23:52     ` Samuel Wales
2021-04-13 14:16       ` Juan Manuel Macías

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='s5c8p9$97n$1@ciao.gmane.io' \
    --to=manikulin@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --subject='Re: [Patch] to correctly sort the items with emphasis marks in a list' \
    /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

Code repositories for project(s) associated with this 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).