8

I know I can use something like #+INCLUDE: "./filepath" but this has effect only when I export the file. I can also use link like [[./filepath]] but I have to type C-c C-o to go to the content.

How to automatically expand this include or this link to the current file? It is useful to use C-s (ISearch) and other practical things like edit the external content inline without change buffer or window.

Thank you.

EDIT: I know I can type C-x i to insert a content of any file inside my current org file, but it isn't what I really want. I want a two-way direct link between my current org file and external files. If I modify the external file, my current org file is automatically updated. And vice-versa.

My current application is: I have a file called mapmind.org where I have my map mind. I use the tool org-mind-map to export this into a beautiful diagram. Unfortunately this tool doesn't allow to export only a region, so this should be in a single separated file. And I have my main org file, called main.org. I have several items and one of them is:

* Map mind
See [[./mapmind.org]].
#+INCLUDE mapmind.org

When I export the entire file into a PDF, for example, I can see my mapmind there. If I put the cursor above the link, I can navigate using C-c C-o, or I can go to file using C-c ' above include line as John Kitchin said as commentary. But this is very unpractical because search commands like C-s, C-r and so on does't find anything in mapmind.org file. Also, I'd like to see and edit the content directly in my main org file without the need to navigate elsewhere.

This feature could be useful for many other applications.

  • 2
    I don't fully understand what you want. You can type C-c ' on the include line to open the file, and then do what you want in it. If you want to insert the contents of a file, you can type C-x i to insert it, but then the resulting text is not connected to the file anymore. – John Kitchin Oct 17 '18 at 16:10
  • 2
    It is feasible but requires some serious elisp skills. One can create a new buffer (as alternative view of the master org file) and combine regions of several files there with multifile.el. The regions are editable, searchable, and so on. Modifications of the view buffer are also applied to the original buffers. org-mode can be activated in the view buffer. I've got a calendar consisting of one org-file per day. I use a similar method to create a view on a certain topic in the files of that calendar spanning several days. – Tobias Oct 18 '18 at 16:21
  • @JohnKitchin I think you actually didn't understand. I edited to try to be more clear. But what I want is show the content in the original buffer linked and updated in "real time" to an external org file. If I modify the file externally, the content is automatically updated, and if I modify the file inside my buffer, the file is modified externally as well. – Felipe Oct 18 '18 at 21:45
  • 1
    You might find some inspiration at emacs.stackexchange.com/questions/12562/…. Otherwise I think you can do what @Tobias suggested. – John Kitchin Oct 19 '18 at 12:01
  • Also related: stackoverflow.com/questions/15328515/… – Felipe Oct 19 '18 at 17:53

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.