From: Ihor Radchenko <yantar92@gmail.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: emacs-orgmode@gnu.org, Sebastian Miele <sebastian.miele@gmail.com>
Subject: Re: Empty headline titles unsupported: Bug?
Date: Sun, 23 May 2021 12:45:02 +0800 [thread overview]
Message-ID: <87zgwmt5wx.fsf@localhost> (raw)
In-Reply-To: <87fsyft0vv.fsf@nicolasgoaziou.fr>
[-- Attachment #1: Type: text/plain, Size: 482 bytes --]
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Empty headline titles are supported, and "org-syntax.org" makes it
> clear.
>
> However, empty headline + tags is ambiguous. The right solution is to
> disambiguate it by inserting "something" as the headline you want to
> tag, like a non-breaking space.
Yet, why not simply alter the headline parser a little bit to support
empty titles + tag? Such headlines are used in some of the tests. See
the attached patch.
Best,
Ihor
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Parse-titeless-headlines-with-a-tag-correctly.patch --]
[-- Type: text/x-diff, Size: 1214 bytes --]
From a65e39125b732f6e091dbabdd63bb46c2463cc99 Mon Sep 17 00:00:00 2001
Message-Id: <a65e39125b732f6e091dbabdd63bb46c2463cc99.1621744991.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Sun, 23 May 2021 12:41:35 +0800
Subject: [PATCH] Parse titeless headlines with a tag correctly
* lisp/org-element.el (org-element-headline-parser): Do not treat tag
as headline title in headlines like "* :tag:".
---
lisp/org-element.el | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lisp/org-element.el b/lisp/org-element.el
index ba4f0ead6..36b8f5847 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -1001,7 +1001,10 @@ (defun org-element-headline-parser (limit &optional raw-secondary-p)
(commentedp
(and (let (case-fold-search) (looking-at org-comment-string))
(goto-char (match-end 0))))
- (title-start (point))
+ (title-start (prog1 (point)
+ (unless (or todo priority commentedp)
+ ;; Headline like "* :tag:"
+ (skip-syntax-backward " \t"))))
(tags (when (re-search-forward
"[ \t]+\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$"
(line-end-position)
--
2.26.3
next prev parent reply other threads:[~2021-05-23 4:40 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-22 11:15 Empty headline titles unsupported: Bug? Sebastian Miele
2021-05-22 12:21 ` Nicolas Goaziou
2021-05-23 4:45 ` Ihor Radchenko [this message]
2021-05-23 14:06 ` Nicolas Goaziou
2021-05-23 14:33 ` Ihor Radchenko
2021-05-23 14:55 ` Nicolas Goaziou
2021-05-23 15:22 ` Ihor Radchenko
2021-05-24 11:01 ` Sebastian Miele
2021-05-24 10:37 ` Sebastian Miele
2021-09-26 9:04 ` Bastien
2021-09-26 23:47 ` Tom Gillespie
2021-09-27 19:59 ` Nicolas Goaziou
2021-09-29 11:26 ` Bastien
2021-05-24 10:46 ` Sebastian Miele
2021-05-24 22:17 ` David Masterson
2021-05-25 10:43 ` Sebastian Miele
2021-05-25 11:43 ` Sebastian Miele
2021-05-25 16:10 ` Nicolas Goaziou
2021-05-25 21:04 ` David Masterson
2021-05-25 23:06 ` Tim Cross
2021-05-26 23:37 ` David Masterson
2021-05-26 14:07 ` Ihor Radchenko
2021-05-26 23:42 ` David Masterson
2021-05-27 3:29 ` Ihor Radchenko
2021-05-27 22:35 ` David Masterson
2021-05-28 5:36 ` Tom Gillespie
2021-05-29 6:21 ` David Masterson
2021-05-29 6:54 ` Tom Gillespie
2021-05-29 8:04 ` Ihor Radchenko
2021-05-29 19:33 ` Tom Gillespie
2021-05-30 4:06 ` Ihor Radchenko
2021-05-29 14:09 ` Ihor Radchenko
2021-05-30 2:19 ` David Masterson
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=87zgwmt5wx.fsf@localhost \
--to=yantar92@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=mail@nicolasgoaziou.fr \
--cc=sebastian.miele@gmail.com \
/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).