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

:include siblings may sometimes include descendants also? #19

Open
akirak opened this issue Oct 15, 2021 · 4 comments
Open

:include siblings may sometimes include descendants also? #19

akirak opened this issue Oct 15, 2021 · 4 comments
Assignees
Labels

Comments

@akirak
Copy link
Contributor

akirak commented Oct 15, 2021

Hello, I have run the latest version of org-make-toc on the README of my project, and there is something wrong with the output.

Both "Guide" and "Design goal" should reside at the same level as "Features", but they are demoted. The output in plain text is as follows:

:CONTENTS:
- [[#features][Features]]
    - [[#when-to-and-when-not-to-use-elinter][When to and when not to use elinter]]
  - [[#guide-how-to-configure-your-emacs-lisp-project][Guide: How to configure your Emacs Lisp project]]
  - [[#design-goal][Design goal]]
:END:

I produced the TOC with my new GitHub Action which runs org-make-toc on CI. It basically runs this script in batch mode with the file given as an argument, so it has no custom Org options set.

Can this be a bug with org-make-toc.el?

@alphapapa
Copy link
Owner

Hi Akira,

Does the bug only happen on the GitHub Action CI?

@akirak
Copy link
Contributor Author

akirak commented Oct 16, 2021

Does the bug only happen on the GitHub Action CI?

No, the bug reproduces on interactive sessions as well, with my extensively customized config. org-make-toc seems to produce exactly the same output between the two environments.

Interestingly, it seems to produce a correct output when I demote the TOC context to the second level. You can get a correct result from the following input:

* New heading
** The TOC context
:PROPERTIES:
:TOC:      :include siblings :depth 2 :ignore this
:END:

:CONTENTS:
:END:

*** Features
*** Guide
*** Design goal

while not from the following one:

* The TOC context
:PROPERTIES:
:TOC:      :include siblings :depth 2 :ignore this
:END:

:CONTENTS:
:END:

** Features
** Guide
** Design goal

@akirak
Copy link
Contributor Author

akirak commented Oct 16, 2021

I'm sorry, but the culpit was :include siblings, which should have been :include descendants. I don't remember why I got it wrong, but correctly specifying the property has fixed the issue:

:PROPERTIES:
:TOC:      :include descendants :depth 2
:END:

It seems that the descendants are included in the TOC in a wrong way if :include siblings is specified in the property. I don't think this is a common case, but it may be another bug.

akirak added a commit to akirak/elinter that referenced this issue Oct 16, 2021
@alphapapa alphapapa changed the title Misindented TOC items :include siblings may sometimes include descendants also? Oct 16, 2021
@alphapapa alphapapa self-assigned this Oct 16, 2021
@alphapapa alphapapa added the bug label Oct 16, 2021
@alphapapa
Copy link
Owner

Thanks.

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

No branches or pull requests

2 participants