From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id mqkdMpimeWAtbAAAgWs5BA (envelope-from ) for ; Fri, 16 Apr 2021 17:00:40 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id QMHRLJimeWB1JwAAB5/wlQ (envelope-from ) for ; Fri, 16 Apr 2021 15:00:40 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 263461993A for ; Fri, 16 Apr 2021 17:00:40 +0200 (CEST) Received: from localhost ([::1]:55884 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lXPxV-00019p-UU for larch@yhetil.org; Fri, 16 Apr 2021 11:00:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53580) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lXPwy-00017y-CI for emacs-orgmode@gnu.org; Fri, 16 Apr 2021 11:00:04 -0400 Received: from ciao.gmane.io ([116.202.254.214]:33524) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lXPww-0001Xs-LF for emacs-orgmode@gnu.org; Fri, 16 Apr 2021 11:00:04 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1lXPwr-0002ZT-Nv for emacs-orgmode@gnu.org; Fri, 16 Apr 2021 16:59:57 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org 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 Message-ID: References: <87a6qg1rjx.fsf@posteo.net> <874kgft7n1.fsf@nicolasgoaziou.fr> <87blanxb1z.fsf@posteo.net> <87v98usaqt.fsf@nicolasgoaziou.fr> <87pmz29xjf.fsf@posteo.net> <877dl6atpj.fsf@posteo.net> <87y2dkrdzl.fsf@posteo.net> <87fszrwgr1.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 In-Reply-To: <87fszrwgr1.fsf@posteo.net> Content-Language: en-US Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 28 X-Spam_score: 2.8 X-Spam_bar: ++ X-Spam_report: (2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FORGED_MUA_MOZILLA=2.309, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, NICE_REPLY_A=-0.001, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1618585240; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=McvxDiW3IVI/2JuHUy+jywmk7xqvoPoyuep/DsRW3m8=; b=LX2WEFnEddnF/6gJENfmYNpdJzOCCKTVM1/+2YlrS5Yz5opu5WrwrjtVhfmJCSZlDd4M4V vc5NBzx0p0hkpiW4Kn3TS2Mud2WXgfVYl+yLUn6CehYGBZ78OwFnkMJA5kdwwFip1FA0p/ cykrPg3ygthi7mR9z9sCNIymih8Ivo8wRFg7HX8lGrnwXlFzAylJ9+kIDgtF3jQpAI+ce2 e7GIIJDdq3GK6C1cqrlFBNFwQKdplgZmeeoqkdtFITvD6ChZUNG11CzRPOjbJgQebC4gEm 2yN3IlQEv/vi9R08mOJDux8Am/xbVPOJaELjAWyawdvUPE3q9nrbt3i9BOnNmA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1618585240; a=rsa-sha256; cv=none; b=oBUdtRo/lfdplnJxxbz4gjDGArV+A3YYaUIoKUY7ibUCiIskk+jlA/9zu2uPx9Nh6cZ2QD IEcg/K9HGJN3tR8lcisTBb+CUJ3pjSz7vAsgJg9Eiu3pWE4HMA3siXgz2CJtms6ogTg33G AqsCWcT6112i7Ju8plT43V+meINX9Snfh3iEMKqN3D24DE/y9J79flRTRa4hg9E21hZ5yK YUo2rXaY9iYvQRM8CHz2FY/W8PbpW/AGJa8HU7V4HL0EwwUJ9QNolA6a8YtgynbViLZa1G 0ntZQH2Ki3DLpP5Vd1++N1pE/Sen34ugbvCrIj83aDFzlbJrZZRBQ8r1alQASQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -1.84 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 263461993A X-Spam-Score: -1.84 X-Migadu-Scanner: scn0.migadu.com X-TUID: DwkVWQxIBXhs 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 " 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.