[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Patch] to correctly sort the items with emphasis marks in a list
From: |
Maxim Nikulin |
Subject: |
Re: [Patch] to correctly sort the items with emphasis marks in a list |
Date: |
Fri, 16 Apr 2021 21:59:51 +0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 |
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.
- Re: [Patch] to correctly sort the items with emphasis marks in a list, (continued)
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Nicolas Goaziou, 2021/04/10
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Juan Manuel Macías, 2021/04/10
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Maxim Nikulin, 2021/04/13
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Juan Manuel Macías, 2021/04/13
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Maxim Nikulin, 2021/04/14
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Maxim Nikulin, 2021/04/14
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Juan Manuel Macías, 2021/04/14
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Juan Manuel Macías, 2021/04/14
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Maxim Nikulin, 2021/04/15
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Juan Manuel Macías, 2021/04/15
- Re: [Patch] to correctly sort the items with emphasis marks in a list,
Maxim Nikulin <=
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Maxim Nikulin, 2021/04/16
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Maxim Nikulin, 2021/04/17
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Juan Manuel Macías, 2021/04/18
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Juan Manuel Macías, 2021/04/18
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Nicolas Goaziou, 2021/04/19
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Maxim Nikulin, 2021/04/19
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Nicolas Goaziou, 2021/04/19
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Greg Minshall, 2021/04/19
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Tom Gillespie, 2021/04/19
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Greg Minshall, 2021/04/19