Skip to content

Commit

Permalink
Warn the user which line has the empty headline
Browse files Browse the repository at this point in the history
This change correctly reports the line where a headline returned nul from the
call to `org-heading-components'.  Warnings are delayed and displayed after the
command to generate the TOC completes.

Signed-off-by: Psionik K <73710933+psionic-k@users.noreply.github.com>
  • Loading branch information
psionic-k committed Nov 28, 2022
1 parent 334aa14 commit 2dbf776
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions org-make-toc.el
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,11 @@ with the destination of the published file."
(seq-intersection org-make-toc-exclude-tags (org-get-tags))
;; NOTE: The "COMMENT" keyword is not returned as the to-do keyword
;; by `org-heading-components', so it can't be tested as a keyword.
(when-let ((headline-text ((nth 4 (org-heading-components)))))
(string-match-p (rx bos "COMMENT" (or blank eos)) headline-text)))
(if-let ((headline-text (nth 4 (org-heading-components))))
(string-match-p (rx bos "COMMENT" (or blank eos)) headline-text)
(delay-warning 'wrong-type-argument
(format "Empty headline on line %s"
(line-number-at-pos (point) t)))))
(funcall org-make-toc-link-type-fn)))
(entry-match (property value)
(when-let* ((found-value (entry-property property)))
Expand Down

0 comments on commit 2dbf776

Please sign in to comment.