David Talmage writes: > On Fri, Dec 9, 2016 at 11:28 AM, Eric S Fraga <e.fr...@ucl.ac.uk> wrote: > >> On Friday, 9 Dec 2016 at 15:29, John Kitchin wrote: >> > Hi all, >> > >> > I have an idea for how I could transclude "copies" or links to >> >> [...] >> >> > Any thoughts? Do you see any potential issues? >> >> Potentially very interesting and useful idea. Some thoughts/issues: >> >> > I'm interested in this, too. In my lab notebook org file, I have a section > that should be put into its own file and either linked or transcluded in > several places. Transclusion would be better because I could see the text > without following a link. It suits my lazy nature. ;-)
It turns out to be pretty easy to see the text; that can be done with a simple overlay. What is not easy, is to be able to edit the text, or use the text with org-machinery, e.g. org-map-entries. The text in the overlay is not visible to the org-machinery, so you can not get properties, edit it, etc... Editing could be made possible with a special buffer, but it doesn't seem likely that you can make the overlay display work with many org-functions. I did have some success making bi-directional editing possible with modification-hooks on an overlay on the copied text, but it is tricky to do and I ran into some other difficulties I have not been able to get past. 1. having a transcluded headline at a different level than the source. E.g. I want to group headlines under a heading in one document, but they are all first level headings in another document. 2. having an org-id in more than one location confuses org-id and causes some issues. This suggests you might want some kind of transcluded id, that is different than the source id. > > >> ... >> >> - what about more than level of indirection: link to a trancluded >> headline which transcludes to another etc. What is shown? Is there a >> performance hit? >> >> > It seems to me that transclusion should be transitive. A transcluded org > file should be able to transclude other org files. It should be > transclusion all the way down. > > It also seems to me that org-mode transclusion must detect cycles so that > it does not infinitely transclude documents. that would be a good idea! > > - what happens if the destination moves or gets deleted? the link to >> it, which looked like something "complete" is now meaningless. This >> could be quite confusing. This is probably the most serious issue. >> > > How does org-mode handle broken links now? That's probably the right way > to handle broken transclusion. > > > >> - the table aspect is almost a "view" on a database which is really >> appealing but would benefit from a fully defined syntax a la sql? >> Would table formulas work as expected from the view of the contents? >> >> > Why wouldn't table formulas work? Transclusion is/could be/should be just > another way to put org-mode formatted text into an org-mode buffer. > > ... >> >> - could we have "read-only" views? I may not want the original touched. >> > > Perhaps that would be property of the transcluded document. > > > >> - how does an export work? On the view or the actual contents? >> >> > Export works on the view. -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu