From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?q?Sebastian=20Reu=C3=9Fe?= Subject: [BUG] org-sort-entries errors out when headline is empty Date: Tue, 13 Mar 2018 17:51:43 +0100 Message-ID: <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]:41588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evnA0-0005pA-0Q for emacs-orgmode@gnu.org; Tue, 13 Mar 2018 12:52:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evn9v-0002rz-1g for emacs-orgmode@gnu.org; Tue, 13 Mar 2018 12:52:24 -0400 Received: from wirrsal.net ([188.68.36.149]:50322 helo=mail.wirrsal.net) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1evn9u-0002qp-NT for emacs-orgmode@gnu.org; Tue, 13 Mar 2018 12:52:18 -0400 Received: from localhost (i59F54E16.versanet.de [89.245.78.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wirrsal.net (Postfix) with ESMTPSA id 95F8E458635 for ; Tue, 13 Mar 2018 17:52:15 +0100 (CET) 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: emacs-orgmode@gnu.org So, I=E2=80=99ve noticed that when sorting a subtree (alphabetically or n= umerically), =E2=80=98org-sort-entries=E2=80=99 will raise an error arising from the c= all to =E2=80=98org-sort-remove-invisible=E2=80=99 (lines 8761 and 8766 in bc7b2= 4d0d). I=E2=80=99m following up with a test. The error is triggered by the captu= re group in =E2=80=98org-complex-heading-regexp=E2=80=99 returning nil, which is then= passed on to =E2=80=98org-sort-remove-invisible=E2=80=99, which expects a string and c= hokes on the nil. As for a fix, the quick fix would be guarding against this case in =E2=80=98org-sort-remove-invisible=E2=80=99, but that seemed a bit meh si= nce sanitation should probably be handled higher up. 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. 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. Any thoughts? Kind regards, SR --=20 Insane cobra split the wood Trader of the lowland breed Call a jittney, drive away In the slipstream we will stay