From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [BUG] org-sort-entries errors out when headline is empty Date: Tue, 20 Mar 2018 09:53:09 +0100 Message-ID: <87lgenb022.fsf@nicolasgoaziou.fr> References: <20180313165145.27160-1-seb@wirrsal.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42814) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyD1C-0007EF-PU for emacs-orgmode@gnu.org; Tue, 20 Mar 2018 04:53:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyD19-0000O4-NG for emacs-orgmode@gnu.org; Tue, 20 Mar 2018 04:53:18 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:43773) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eyD19-0000Mr-HG for emacs-orgmode@gnu.org; Tue, 20 Mar 2018 04:53:15 -0400 In-Reply-To: <20180313165145.27160-1-seb@wirrsal.net> ("Sebastian =?utf-8?Q?Reu=C3=9Fe=22's?= message of "Tue, 13 Mar 2018 17:51:43 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Sebastian =?utf-8?Q?Reu=C3=9Fe?= Cc: emacs-orgmode@gnu.org Hello, Sebastian Reu=C3=9Fe writes: > An alternative is to guard inside =E2=80=98org-sort-entries=E2=80=99. I= =E2=80=99m following up with an > implementation of this. Applied. Thank you! I used `org-get-heading', which handles empty headlines without messing with `org-complex-heading-regexp'. > I was also wondering if it might make sense to tweak > =E2=80=98org-complex-heading-regexp=E2=80=99 so that the respective captu= re group captures an > empty string. This could be achieved by making the title group greedy aga= in > (reverting 9d334897e). Whether we want this probably depends on the motiv= ation > for 9d334897e. However, doing so would be more consistent with the org-el= ements > API, which does assign a tag list to the title property when the heading = is > otherwise empty. How should we treat the following: * :something: Is it an empty headline with a "something" tag, or a ":something:" headline with no tag? All things being equal, it doesn't matter much, whichever answer is chosen, we can get the other one with a zero-width space or some such. However, it is too early to answer this, because tags are handled inconsistently across the code base. See, e.g., the number of occurrences of ":[[:alnum:]_@#%:]+:" in "org.el". The tags regexp is hard-coded in too many places. This is why, even though 9d334897e was an answer to the initial question, it is incomplete. Reverting it would be as incomplete. IMO, we should first clarify tags definition. There's already `org-get-tags-at' and `org-get-local-tags' (which could be optimized, BTW), but we may need a proper tags-regexp, e.g., (concat org-outline-regexp-bol ".*[ \t]\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$") or use consistently `org-get-tags-at'. Then we can answer the initial question. WDYT? Regards, --=20 Nicolas Goaziou