emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: "Sebastian Reuße" <seb@wirrsal.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] org-sort-entries errors out when headline is empty
Date: Tue, 20 Mar 2018 09:53:09 +0100	[thread overview]
Message-ID: <87lgenb022.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <20180313165145.27160-1-seb@wirrsal.net> ("Sebastian Reuße"'s message of "Tue, 13 Mar 2018 17:51:43 +0100")

Hello,

Sebastian Reuße <seb@wirrsal.net> 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:]_@#%:]+:" 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,

-- 
Nicolas Goaziou

  parent reply	other threads:[~2018-03-20  8:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Nicolas Goaziou [this message]
2018-03-23 10:43   ` [BUG] org-sort-entries errors out when headline is empty Sebastian Reuße
2018-04-20  9:30     ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lgenb022.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=seb@wirrsal.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).