Is there a way to have contents of a heading of an .org file echoed in another .org file, so that the text in the second file would be updated automatically when the first file changes?

For example, suppose that we have .org files dedicated to branches of a company, as follows.

The contents of new-york-branch.org:

* Location       :location:
  New York   
* Director       :director:
  John Smith

The contents of washington-branch.org:

* Location       :location:
* Director       :director:
  Ann Grey

Then we would somehow be able to compose a file index.org like this:

* Branches
** New York
   Director: John Smith
** Washington
   Director: Ann Grey

In the file index.org above, John Smith and Ann Grey are echos of the contents of new-york-branch.org:director and washington-branch.org:director, respectively. There will probably be some hidden text as well to specify these data sources. In any case, if Ann Grey is replaced by Susan May in washington-branch.org, the change will get reflected in index.org automatically. Please note that I am not looking for #+INCLUDE, since I would like the change to be reflected in org-mode, without the need to export.

Can this be done?

  • I like to use the org-id feature for jumping to/from locations within the same or different files. If you do implement your own feature request, it would probably be a good idea to use a unique way of identifying the different locations instead of relying upon a word search since there may be more than one match using the latter method. My recollection is that there is another thread that inquires about this feature and it seems like 4 to 6 months ago, but I'm not sure and haven't yet performed Google searches to locate the other thread. – lawlist Jun 7 '17 at 19:00
  • 1
    I think this is called transclusion. See stackoverflow.com/questions/15328515/… for one approach to the solution. An alternative approach was discussed on the org mailing list: mail-archive.com/emacs-orgmode@gnu.org/msg110355.html. – John Kitchin Jun 8 '17 at 22:32
  • @JohnKitchin This should be a reply (you might want to discuss the pros and cons of the two approaches), unless my post should be marked as duplicate. – AlwaysLearning Jun 9 '17 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.