branch: externals/org
commit 1cea4094fc50b0ac490c2c1d8a4bc158f9c62526
Merge: 212237bdbd 915e883645
Author: Ihor Radchenko <[email protected]>
Commit: Ihor Radchenko <[email protected]>
Merge branch 'bugfix'
---
lisp/org-lint.el | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/lisp/org-lint.el b/lisp/org-lint.el
index 5b8605e47f..ca59664ecf 100644
--- a/lisp/org-lint.el
+++ b/lisp/org-lint.el
@@ -398,17 +398,24 @@ called with one argument, the key used for comparison."
(dolist (e originals reports) (funcall make-report (cdr e) (car e)))))
(defun org-lint-misplaced-heading (ast)
- "Check for accidentally misplaced heading lines."
+ "Check for accidentally misplaced heading lines.
+Example:
+** Heading 1
+** Heading 2** Oops heading 3
+** Heading 4"
(org-with-point-at ast
(goto-char (point-min))
(let (result)
;; Heuristics for 2+ level heading not at bol.
(while (re-search-forward (rx (not (any "*\n\r ,")) ;; Not a bol; not
escaped ,** heading; not " *** words"
"*" (1+ "*") " ") nil t)
- (unless (org-element-type-p
- (org-element-at-point)
- '(comment-block example-block export-block src-block)
- ) ; Inside a block, where the chances to have heading a slim.
+ ;; Limit false-positive rate by only complaining about
+ ;; ** Heading** Heading and
+ ;; ** Oops heading
+ ;; Paragraph** Oops heading
+ (when (org-element-type-p
+ (org-element-at-point)
+ '(paragraph headline))
(push (list (match-beginning 0) "Possibly misplaced heading line")
result)))
result)))