emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [BUG] org-sort-entries errors out when headline is empty


From: Nicolas Goaziou
Subject: Re: [O] [BUG] org-sort-entries errors out when headline is empty
Date: Tue, 20 Mar 2018 09:53:09 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Hello,

Sebastian Reuße <address@hidden> writes:

> An alternative is to guard inside ‘org-sort-entries’. I’m 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
> ‘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.

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:address@hidden:]+:" 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:address@hidden:]+:\\)[ 
\t]*$")

or use consistently `org-get-tags-at'.

Then we can answer the initial question.

WDYT?

Regards,

-- 
Nicolas Goaziou



reply via email to

[Prev in Thread] Current Thread [Next in Thread]