-
Notifications
You must be signed in to change notification settings - Fork 49
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
Fixes part of issue #91 regarding nested headings #96
base: main
Are you sure you want to change the base?
Conversation
Fixed the combination of some breaking assumptions of `org-transclusion-remove` in the presence of nested transclusioins: - the character right before the beginning of a transclusion is not necessarily an adjacent transclusion. It might be the parent transclusion. - Using `insert-before-markers` to re-insert the `#+transclude: ...` element loses information about the text properties present before inserting the cloned text. This is still prone to bugs but using `insert-before-markers-and-inherit` instead avoids the common case errors.
When inserting the #+transclusion: ... tag on transclusion removal we want to inherit the transclusion properties when it was nested but not when it is adjasent to another transclusion.
Thank you. I will need to spend a bit more time. I didn't know that it was possible to manually call the add function on a transclusion within another transclusion. That itself is a bug -- discrepancy from my original design and should have been prevented in the first place. Your PR tried to make this bug legitimate. This might work but... From my own experience of developing the remove function, it is an area that would require a significant amount of regression if I were to accept your PR. I hesitate to take it as it is for this reason but at the same time it might be a fruitful avenue to pursue... |
Since yesterday I gave rubbed against at least a few of the problems you imply. The biggest problem seems to be that when the transcluded text is removed and the transclude keyword is we have 3 consecutive transclusions:
then all of them are expanded. then we try to remove I have a branch that has a few features I need that you may not necessarily want to add to master (see end). In there I mitigated this issue by including two newlines at the end of the transcluded text that do not get any of the overlays except the read-only ones. When a transclusion is removed the newlines are also removed. This way the end of a transclusion never coincides with the beginning of the next one. Features you may not want:
|
transclusion inside another. This should not happen by design. This commit add `org-transclusion-check-add` and in it a new check has been added to prevent this case. Currently it checks the following two cases: Case 1. Element at point is NOT #+transclude: Case 2. #+transclude inside another transclusion" The PR #96 attempts go beyond this design. It currently seems to complicate the cases for `org-transclusion-remove`. We might revist the case for nesting (a special case of transclusion within another transclusion); however, I am not prepared to go through regression and unaticipated issues with this major change of assumptions.
For now, I am putting a new check to prevent any case of transclusion in another with the new commit 330d761. I believe with this change this following case won't happen, and hopefully every character (if it's in a trascnslusion) right before the beginning of a transclusion is always an adjacent transclusion. No nesting, so no parent transclusion.
In addition... #+transclude: A |
Just wanted to pitch in to say that I'm quite interested in recursion as well. Thanks for looking into this! |
Fixed the combination of some breaking assumptions of
org-transclusion-remove
in the presence of nested transclusioins:the character right before the beginning of a transclusion is not
necessarily an adjacent transclusion. It might be the parent
transclusion.
Using
insert-before-markers
to re-insert the#+transclude: ...
element loses information about the text properties present before
inserting the cloned text. This is still prone to bugs but using
insert-before-markers-and-inherit
instead avoids the common caseerrors.