redlizard3 · 2022-03-23 19:16
I'm writing a dissertation with org-mode. Each chapter lives in its own org file. I also have an outline.org file which holds the outline of all the chapters. Basically, I'm wondering whether it's possible to use #+INCLUDE to *only* import the headers from each file (and none of its content), so that my outline.org file can be updated automatically. This seems like it should be possible, but I haven't been able to figure it out. Any help would be appreciated.
TheGramm · 2022-03-24 17:18
The only thing I could find is:
[https://emacs.stackexchange.com/questions/42398/org-mode-export-headline-without-contents](https://emacs.stackexchange.com/questions/42398/org-mode-export-headline-without-contents)
This seems like something that should be doable. I would suggest checking whether this could be done by org-sparse-tree or org-agenda.
Another idea would be to leverage the fact that for org-mode the headlines must start with asterisk (\*) in the beginning of the line, so something like `grep -HR '^*'` would return all the lines with a headline.
redlizard3 · 2022-03-24 20:03
Thanks for your help. I'll look into org-sparse-tree. I hadn't thought about just writing a bash script, but that's actually a great alternative.
DrownNotably · 2022-03-25 12:05
You could put just a source block in the [outline.org](https://outline.org) file like this:
```
#+begin_src elisp :exports results
(org-map-entries (lambda ()
(thing-at-point 'line t))
nil
'("sample.org" "sample2.org"))
#+end_src
```
Replace the list of sample org files with your chapter's filenames in the order you want them. It should evaluate the code block on export and give you the headings for the files you give it.
da-g · 2022-03-27 01:04
Check out [https://github.com/dangom/org-thesis](https://github.com/dangom/org-thesis)
There are solutions in there for dealing with exactly the kind of issue you are mentioning.
redlizard3 · 2022-04-01 22:42
Nice, I'll look into this.
redlizard3 · 2022-04-01 22:49
Thanks - I had implemented basically the same thing using bash. It seems like "raw" output should be used, though. Although I'd like to have the org file update with this with replacement without having to delete it myself.