4

Goal

In org-mode, you can include parts of other files during export with the keyword #+INCLUDE. I would like to be able to view the included files in-line in the current buffer (and maybe even edit the included text?).

Questions

  • Are there any existing tools for this? (I haven't found any yet.)
  • If not, is this possible?
  • If so, would someone knowledgeable and competent in the ways of elisp give me some pointers on how to start implementing such a feature?

Example

Suppose I have the following org file:

./foo.org:

#+TITLE: Foo

Blah, blah blah.

#+NAME: whitehead-on-notation
#+BEGIN_QUOTE
...by the aid of symbolism we can make transitions in reasoning almost
mechanically by the eye, which otherwise would call in to play the higher
faculties of the brain.
#+END_QUOTE

And I include it in another file:

./bar.org

#+TITLE: Bar

Blah blah blah, blee blah

#+INCLUDE: "./foo::whitehead-on-notation"

Blee blah, blee blah, blo blee.

I would like to be able to execute a function, and have the buffer viewing ./bar.org display

#+TITLE: Bar

Blah blah blah, blee blah

#+INCLUDE: "./foo::whitehead-on-notation"
#+BEGIN_QUOTE
...by the aid of symbolism we can make transitions in reasoning almost
mechanically by the eye, which otherwise would call in to play the higher
faculties of the brain.
#+END_QUOTE

Blee blah, blee blah, blo blee.

But, critically, I want the excerpt to be virtually embedded, so that if anything changes to the text in foo.org, the embedded text will also be updated. If this would require that the displayed text in bar.org be read-only, that is acceptable.

Shon
  • 157
  • 1
  • 9

1 Answers1

1

To see included files you should export your buffer to an Org buffer, as in:

(require 'ox-org)

Then export to Org with C-c C-e O O.

There is a lot going on when you include a file, so the contents cannot simply be virtually embedded. For example, what is supposed to happen to the included content when you change a headline level on the parent file? Should your "virtual" view show you something different from what is in the file, or should it break Org outline levels to respect whatever is in your included document?

What you can do is automate the org buffer export so that it exports every time you hit return for example. You'd then have two windows side by side, one for editing, and one with the exported content.

Daniel
  • 3,563
  • 16
  • 41