Parse titleless headlines with a tag correctly

* lisp/org-element.el (org-element-headline-parser): Do not treat tag
as headline title in headlines like "* :tag:".
This commit is contained in:
Ihor Radchenko 2021-05-23 12:41:35 +08:00 committed by Bastien
parent 31929f539c
commit 32b9251886
1 changed files with 4 additions and 1 deletions

View File

@ -1021,7 +1021,10 @@ Assume point is at beginning of the headline."
(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)