Skip to content

Commit

Permalink
If headline text is empty, allow skipping headline
Browse files Browse the repository at this point in the history
This commit makes the string comparison avoid failure when the title component
is nil, (it's not an empty string).

This occurs for example when a headline is just a TODO cookie with no later
headline text.

The two blocks for generating the link properly attempt to skip headlines where
there is no 4th title component, so later generation correctly handles the case
where an empty link generation would be attempted in the TOC.

Note, empty links will not render nor attempt link behavior.

Signed-off-by: Psionik K <73710933+psionic-k@users.noreply.github.com>
  • Loading branch information
psionic-k committed Nov 28, 2022
1 parent 26fbd6a commit 334aa14
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions org-make-toc.el
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ 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.
(string-match-p (rx bos "COMMENT" (or blank eos))
(nth 4 (org-heading-components))))
(when-let ((headline-text ((nth 4 (org-heading-components)))))
(string-match-p (rx bos "COMMENT" (or blank eos)) headline-text)))
(funcall org-make-toc-link-type-fn)))
(entry-match (property value)
(when-let* ((found-value (entry-property property)))
Expand Down

0 comments on commit 334aa14

Please sign in to comment.