Skip to content
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

TODO headline degeneracy cause nil string match error #27

Open
psionic-k opened this issue Nov 17, 2022 · 3 comments · May be fixed by #28
Open

TODO headline degeneracy cause nil string match error #27

psionic-k opened this issue Nov 17, 2022 · 3 comments · May be fixed by #28

Comments

@psionic-k
Copy link

* TODO
  There is no text in this headline, and TOC update will fail.  Ignoring is fine.  This is degenerate.
@alphapapa
Copy link
Owner

I don't think that ignoring the problem is a good solution. The user may expect a link to be generated, or the user may not be aware of the "dangling" heading entry.

@psionic-k psionic-k linked a pull request Nov 18, 2022 that will close this issue
@psionic-k
Copy link
Author

This issue is a duplicate of #13

I've force pushed my branch to read a bit cleaner. Then I added a user warning for us to discuss.

The error was caused by attempting to do a string comparison on a nil. org-heading-components will return nil for cases demonstrated in #13

The downstream behavior in org-make-toc--link-entry-github and org-make-toc--link-entry-org correctly skips creating the link for the empty title already.

The warning reports the line for which there is no title that the downstream behavior would use to generate a link.

As a matter of style, should the warning happen in both downstream bodies, which perhaps can behave differently given that they use different link generation logic? The warning can happen at a more generic point as shown in the PR without needing to maintain both downstream link type branches. I don't believe there's a good basis for a decision in this case and will defer to opinion.

I don't believe that any other behavior such as "generating an empty link" can be a more correct way to inform the user. Generating an empty link is feedback, but it's more explicit feedback to send a warning message. Even if we do generate some other form of link, without an error message, the output is slightly confusing, partly because it won't render or behave as a link e.g. [[][]] in org mode won't render or behave.

@psionic-k
Copy link
Author

No updates upon reread. We should finish up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants