-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty links warn #28
base: master
Are you sure you want to change the base?
Empty links warn #28
Conversation
I appreciate the PR, but with regard to #27, it would be helpful if we decided what to do in plain English before deciding how to change the code. If you'd like, please discuss some ideas there first. |
ea31461
to
334aa14
Compare
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 would not render or behave, so forcing their generation would be incorrect anyway. Signed-off-by: Psionik K <73710933+psionic-k@users.noreply.github.com>
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>
(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 'org-make-toc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't understand the manual or docstring's explanation of the TYPE argument to delay-warning
, but use-package macros expand such that they use the package name symbol when calling display-warning
. As far as I can tell, any symbol is accepted, and the output to the user looks informative when done this way.
Normalizing away nils in the 4th header component results in org warning the user that they have an empty link. The TOC does not finish generation in this case.
At first I just fixed the string-match-p call, but this will complete without generating user feedback about the empty title.
fixes #27
fixes #13
Signed-off-by: Psionik K 73710933+psionic-k@users.noreply.github.com