From a65e39125b732f6e091dbabdd63bb46c2463cc99 Mon Sep 17 00:00:00 2001 Message-Id: From: Ihor Radchenko 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