emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] org-sort-entries errors out when headline is empty
@ 2018-03-13 16:51 Sebastian Reuße
  2018-03-13 16:51 ` [PATCH 1/2] Extend org-sort-entries test Sebastian Reuße
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Sebastian Reuße @ 2018-03-13 16:51 UTC (permalink / raw)
  To: emacs-orgmode

So, I’ve noticed that when sorting a subtree (alphabetically or numerically),
‘org-sort-entries’ will raise an error arising from the call to
‘org-sort-remove-invisible’ (lines 8761 and 8766 in bc7b24d0d).

I’m following up with a test. The error is triggered by the capture group in
‘org-complex-heading-regexp’ returning nil, which is then passed on to
‘org-sort-remove-invisible’, which expects a string and chokes on the nil.

As for a fix, the quick fix would be guarding against this case in
‘org-sort-remove-invisible’, but that seemed a bit meh since sanitation should
probably be handled higher up.

An alternative is to guard inside ‘org-sort-entries’. I’m following up with an
implementation of this.

I was also wondering if it might make sense to tweak
‘org-complex-heading-regexp’ so that the respective capture group captures an
empty string. This could be achieved by making the title group greedy again
(reverting 9d334897e). Whether we want this probably depends on the motivation
for 9d334897e. However, doing so would be more consistent with the org-elements
API, which does assign a tag list to the title property when the heading is
otherwise empty.

Any thoughts?

Kind regards,
SR

-- 
Insane cobra split the wood
Trader of the lowland breed
Call a jittney, drive away
In the slipstream we will stay

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-04-20  9:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-13 16:51 [BUG] org-sort-entries errors out when headline is empty Sebastian Reuße
2018-03-13 16:51 ` [PATCH 1/2] Extend org-sort-entries test Sebastian Reuße
2018-03-13 16:51 ` [PATCH 2/2] Guard against empty headings when sorting Sebastian Reuße
2018-03-20  8:53 ` [BUG] org-sort-entries errors out when headline is empty Nicolas Goaziou
2018-03-23 10:43   ` Sebastian Reuße
2018-04-20  9:30     ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).