feat: Remove blank lines at end of transcluded content.#292
feat: Remove blank lines at end of transcluded content.#292AndreasMatthias wants to merge 5 commits intonobiot:mainfrom
Conversation
|
Sorry. I guess this is not the right way to fix it. And it won't work for live-sync too. |
|
This is much harder than I tought it would be. I close it for now. |
|
@AndreasMatthias , I am not sure if I can reproduce the issue, but what exactly are you trying to "fix"? Maybe it's a matter for you to have I don't know if I have seen an issue raised and we talked about it, but perhaps you can try to create a new issue and describe it with repro procedure. |
|
I'm sorry for the word "fix". I called my branch "fix" and thus used "fix" in the PR. But actually it was meant to be a proposal: I prefer to put one (only one) blank line between paragraphs. And I do the same for transcluded contents, i.e I prefer to put one blank line between the transcluded content and the other content of my org file. But sometimes the transcluded content itself already contains one or more blank lines at its end which leads to several blank lines in between. So I tried to remove the additional blank lines in the transcluded content. I have a much better solution now, working with live-sync as well, but it still breaks sometimes. I'll get back to you once I've sorted things out. |
|
No worries about the word "fix". I was not implying any my emotional state (I had none 😄 ). I was simply saying that I do not seem to be able to reproduce the "issue", and without one I could not think of a "fix"...
I would like to explore the conditions for this "sometimes". Do you have any ideas? In my case it appears the transcluded contents never contain extra blank lines at their end (when the original does not contain them) -- so they are always the same. Are you saying that you want to have extra blank lines in your original but want to trim them when transcluded? If so, then it makes sense that live edit does not work because the original and copy do not match exactly. |
|
Yes excatly. I don't want the extra blank lines of the original file be transcluded. This is Now I transclude this file with: What I'd expect is: But the actual result is this: |
|
In my case, I have If you need to work with files with extra blank lines, because you don't have full control over these files...or you'd simply prefer to have extra blank lines anyway in the original files... I would look into the following two methods within the framework of Org-transclusion. If my design is correct and I implemented it correctly, they should not affect live sync edit (live sync would still include the full content of the file including the extra blank lines). I may prefer Method 2 (at least that's what I'd try first), because Method 1 may cause discrepancy between the content and the overlay's range.... But in either methods, more testing should be done. I assumed you only needed to cater to text and program source files. Org files have a different set of content and content-format functions, so I didn't consider them (see variable Just a thought from me. Method 1. Modify the content in the payloadFor text files (except for program source) For program source: Method 2. Modify the content's format when content is insertedFor text files (except for program source) For program source: |
This reverts commit 9e7916b.
During transclusion: Blank lines at the end of the contents are not transcluded. During live-edit: Blank lines added by the user at the end of the contents are removed.
|
I guess this could work. However be careful, this commit is not tested thoroughly. This commit ignores/removes blank lines
File In |
|
Reported some time ago: #221 |
This PR removes blank lines at the end of transcluded content.
For example
will become after transclusion
Note that there are no blank lines at the end of the transcluded content although
the original files (see below) have blank lines at their ends.
File
test.org:File
test.el: