> Sounds reasonable. Could you prepare a patch?
> COMMENT should be inside a shy group and note that there might be an
> arbitrary number of space after COMMENT string.

Here it is.

>From 54cd366c97bd64c226cc6fc79e125ee9f026ff66 Mon Sep 17 00:00:00 2001
From: Ignacio <ignacioca...@hotmail.com>
Date: Fri, 6 May 2022 13:51:14 +0200
Subject: [PATCH] lisp/org.el: match COMMENT in
 `org-complex-heading-regexp-format'

---
 lisp/org.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/org.el b/lisp/org.el
index 1d5fc3903..0ec717322 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4213,6 +4213,8 @@ related expressions."
 		      "\\(?: +" org-todo-regexp "\\)?"
 		      "\\(?: +\\(\\[#.\\]\\)\\)?"
 		      "\\(?: +"
+                      ;; Headline might be commented
+                      "\\(?:" org-comment-string " +\\)?"
 		      ;; Stats cookies can be stuck to body.
 		      "\\(?:\\[[0-9%%/]+\\] *\\)*"
 		      "\\(%s\\)"
-- 
2.25.1

Reply via email to