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

org-transclusion-live-sync-start inconsistent behavior with org heading entries. #175

Open
ffsammak opened this issue Mar 6, 2023 · 5 comments

Comments

@ffsammak
Copy link

ffsammak commented Mar 6, 2023

live-sync is a game-changer by all means, but I noticed different treatment of heading entries given the two use scenarios below:

Scenario 1: #+transclude: [[file:<filename>]] :lines 6-8
you transclude a range of lines including a heading, live-sync works as expected, yet I cannot do P or D to promote or demote the transcluded entry.

Scenario 2: #+transclude: [[file:<filename>::*Heading][sometext]] :level 3
You can P and D the transcluded entry, yet you cannot do live-sync on it.

Is this a limitation or a bug on my end only. Thanks for the great work behind this must-transclude package in your emacs setup.

Emacs: GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0)
of 2023-03-02
Framework: vanilla emacs
Org: Org mode version 9.6.1
Org-transclusion: Version: 1.3.2 on 05 March 2023

@ffsammak ffsammak changed the title org-transclusion-live-sync-start strange behavior when entries are transcluded by :level argument. org-transclusion-live-sync-start strange behavior with entries. Mar 6, 2023
@ffsammak ffsammak changed the title org-transclusion-live-sync-start strange behavior with entries. org-transclusion-live-sync-start inconsistent behavior with entries. Mar 6, 2023
@ffsammak ffsammak changed the title org-transclusion-live-sync-start inconsistent behavior with entries. org-transclusion-live-sync-start inconsistent behavior with org heading entries. Mar 7, 2023
@nobiot
Copy link
Owner

nobiot commented Mar 8, 2023

Scenario 1
I think what's happening is that when you have :lines prop, the transclusion will treat the transcluded region as coming from a plain text file (not Org file), even when the transclusion source is an Org element/file. P and D works because it adds the :level property. However, the level property works only when the transcluded region is treated as an Org, not a plain text file.

Between :level and :lines properties, the default is to treat the latter priority. See the sequence of list in the variable org-transclusion-add-functions -- org-transclusion-add-src-lines does the :lines and it should be the head of the list (priority 1).

You could change the priority, but then the :lines property would not work when other add-function takes precedent.

Scenario 2
Live sync works better when the transclusion is plain text. When it is an Org (Scenario 2 is for Org), only a certain Org element works with live-sync. This is described in user manual section 6 Known Limitations. The technical limitation is described more in detail in this thread.

@ffsammak
Copy link
Author

ffsammak commented Mar 8, 2023

Thanks for the feedback. I went through the limitations actually before filing this issue here and I couldn't find "heading entries" as one of the org-elements beside others:

It is known that live-sync does not work for the other Org
elements: comment-block, export-block, example-block,
fixed-width, keyword, src-block, and property-drawerd.

So the headings element can also be added to the above list I guess. I hope one day you would overcome these limitations. So I will continue using scenario 2 but edit the source, then g on transclusion(s) to update till these limitations are dealt with. Thanks again.

@nobiot
Copy link
Owner

nobiot commented Mar 8, 2023

So the headings element can also be added to the above list I guess.

Thank you. I am thinking along the following lines. Your thoughts will be appreciated.

The limitation section also has the positive list of elements that are known to work. I am considering just keeping it only and removing the negative list of those that do not work. I included the negative list in the hope that it would help the reader. But your comment is perhaps an indication that it was rather more confusing than clarifying. What do you think?

   • ‘org-transclusion-live-sync-start’ does not support all Org
     elements For transclusions of Org elements or buffers, live-sync
     works only on the following elements: ‘center-block’, ‘drawer’,
     ‘dynamic-block’, ‘latex-environment’, ‘paragraph’, ‘plain-list’,
     ‘quote-block’, ‘special-block’, ‘table’, and ‘verse-block’.

@ffsammak
Copy link
Author

ffsammak commented Mar 9, 2023

Yes, I fully support your notion. The positive list is easier to maintain and will notify the reader what org-element has been editable so far as this list would continue to grow.

@nobiot
Copy link
Owner

nobiot commented Mar 11, 2023

@ffsammak Thank you for you feedback.
Just in case I had not been clear: For scenario 2, the current design is not to let you live-edit the whole headline but, as shown in the GIF demo in README, you can do live-edit one paragraph by paragraph (or element by element that is live-sync is possible).

So you may not be able to go in to the live-edit mode when the point is on the headline title (the line where you have the star(s) "*" but you should be able to do so within in the subtree -- I am not sure if I would like the entire headline to be editable at once... This is my current thinking.

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

No branches or pull requests

2 participants