diff --git a/lisp/org.el b/lisp/org.el index 68f596c3d..17f5d9c1d 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -18657,7 +18657,8 @@ Optional argument ELEMENT contains element at BEG." (org-with-wide-buffer (when beg (goto-char beg)) (setq element (or element (org-element-at-point))) - (if (not (org-element-lineage element '(headline inlinetask))) + (if (or (eq (org-element-type element) 'headline) + (not (org-element-lineage element '(headline inlinetask)))) nil ; Not inside heading. ;; Skip to top-level parent in section. (while (not (eq 'section (org-element-type (org-element-property :parent element))))