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 f8zSCeGifGBPYQAAgWs5BA (envelope-from ) for ; Sun, 18 Apr 2021 23:21:37 +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 +Dt9A+GifGBYfQAAB5/wlQ (envelope-from ) for ; Sun, 18 Apr 2021 21:21:37 +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 85B891B64D for ; Sun, 18 Apr 2021 23:21:36 +0200 (CEST) Received: from localhost ([::1]:47660 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lYErG-00089c-E3 for larch@yhetil.org; Sun, 18 Apr 2021 17:21:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58268) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lYEqO-00087u-7W for emacs-orgmode@gnu.org; Sun, 18 Apr 2021 17:20:40 -0400 Received: from mout01.posteo.de ([185.67.36.65]:36295) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lYEqM-0001Bf-Ab for emacs-orgmode@gnu.org; Sun, 18 Apr 2021 17:20:39 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id EED7C240026 for ; Sun, 18 Apr 2021 23:20:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1618780835; bh=H/lXYxpKAAm1dzjUogkiFrvTr8HRxk//ArbSTnS02Rg=; h=From:To:Subject:Date:From; b=BRrNM3YwRTytW4MG+ZbNP28qqBHs55Lygj2TxVDTXMTtd6/JvyRgIVzax6zHq9A6s dfzqJoBXuI742B157SZUITt8Cyt34Txp+nfuNTbXB5l4jUhA23cJj9GfckBeHt45tn cDw+dCFsT34G0C0FQztd9CsR578rW7JkQvdvLmbWbf2R/1P/hT73dIRx3LOTT5eDzN tHSNUpdd+7V/s+VwnxkI6mVyprg+DSHmmHcHDIcjOIHvuB18FZLnyNs8ceVAUXWkm1 WxsvX5ndnSSR+pYCeK/hldw19P52Mmuip6sSIKH4B3wY7vRmxfc3wjs6e3f8JI2QPK ESDlTtgs8ZkAQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4FNjXf2yJ3z9rxB for ; Sun, 18 Apr 2021 23:20:34 +0200 (CEST) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: orgmode Subject: Re: [Patch] to correctly sort the items with emphasis marks in a list References: <87a6qg1rjx.fsf@posteo.net> <874kgft7n1.fsf@nicolasgoaziou.fr> <87blanxb1z.fsf@posteo.net> <87lf9fa3ak.fsf@posteo.net> Date: Sun, 18 Apr 2021 21:20:32 +0000 In-Reply-To: <87lf9fa3ak.fsf@posteo.net> ("Juan Manuel =?utf-8?Q?Mac=C3=AD?= =?utf-8?Q?as=22's?= message of "Sun, 18 Apr 2021 17:52:19 +0000") Message-ID: <87sg3n8f33.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.67.36.65; envelope-from=maciaschain@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_FMBLA_NEWDOM=1.499, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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=1618780896; 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:dkim-signature; bh=GxfCHa78Wxs45v3Z133oWRzXIE+iTxnW0dSisbQuf3s=; b=L0+gPrip6kMLIZniPAWlWJk69dY46daV15IESQdfuXbOLwhB6Ba8TbKywmJ7t2kwuBQNXE 4DMAAvMkeOmYs6eFhYob2wvpQc+o1DYPApUO1hAYO7Ikxj5ZMF5r/Ex0UgD6LI/Y5qKPrV MREFZ/QurZA6446Os+dLkmBAoqqDb50IWGo/7o3MCxZzL8ZaOv+p+dgJv5itq4dHCOLf1k tm0swWYMK3zI0bswyWjHOP28Q/TgbwgXutGpDa1/B625mK2csiwWXGy17fxO4ZpbL9Z7f9 FWTJvkbu2DELabo/hDuukNgQrveyyjq4MvhuBLIHFBfIjOm7CopSBNLp/UaglQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1618780896; a=rsa-sha256; cv=none; b=NFDE4ZVI7sRKnDJrnuWcdiDxKh82b0sNZ4pSX8zzfbhb8xVcW1hSN0cge+rC0hmfj0EqG4 b4XqaZvdqPTWfF/0G+zxiXCgffRWj2t08OSAN+Ix0H9nq9pLDDagxI+Jdtd8JsadspPJH3 C6XJNAuSiMwhEveSxpMdVsGop8MJVGjLEQ5spwEVSecyaVL4Wda/t1CMGj4SPUaUj2F/bG 0vJvrXcpqUCKYX/ysZUDbopCfnoq8DY9VNOGyBhHStZ3atDjw4PMaoSjRXq1WHE1/OCAdA zvJ3NErshhIXWcQQn563gauwH6u3J1Z+NzOlgS/NecdV3qH7EklDvCqG5Vl2Jw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=BRrNM3Yw; dmarc=pass (policy=none) header.from=posteo.net; 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: -3.14 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=BRrNM3Yw; dmarc=pass (policy=none) header.from=posteo.net; 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: 85B891B64D X-Spam-Score: -3.14 X-Migadu-Scanner: scn0.migadu.com X-TUID: XQNg7U34P9Zf Juan Manuel Mac=C3=ADas writes: > It seems that what I was proposing as a patch at the beginning is not, > finally, a viable solution for all contexts... > > The problem is that, if the first space is removed, we get this > abnormal result: > > #+begin_src emacs-lisp > (org-sort-remove-invisible "- lo /bueno/") > #+end_src > > #+RESULTS: > : - lobueno I wonder if this other approach can be viable or if it is something crazy: if the spaces in org-sort-remove-invisible are a problem only for the first emphasis of each item, how about this fix to org-sort-list? (not modifying org-sort-remove-invisible): @@ -2940,10 +2940,20 @@ function is being called interactively." (org-sort-remove-invisible (buffer-substring (match-end 0) (point-at-eol))))) ((=3D dcst ?a) - (funcall case-func - (org-sort-remove-invisible - (buffer-substring - (match-end 0) (point-at-eol))))) + (if (save-excursion + (beginning-of-line) + (forward-char) + (looking-at-p org-emph-re)) + (replace-regexp-in-string + "\\(^\\)\s+" "\\1" + (funcall case-func + (org-sort-remove-invisible + (buffer-substring + (match-end 0) (point-at-eol))))) + (funcall case-func + (org-sort-remove-invisible + (buffer-substring + (match-end 0) (point-at-eol)))))) ((=3D dcst ?t) (cond ;; If it is a timer list, convert timer to seconds