Andreas Leha <[email protected]> wrote:
> Hi all,
>
> what is the best way to export the whole current tree (starting from the
> top-level headline)?
>
> Background:
> I have some documents with this structure
>
> ,----
> | * Document 1
> |
> | * Document 2
> |
> | * Some Functions
> |
> | * Some more Functions
> `----
>
> Now, when I am editing somewhere deep inside the Document 2. How do I
> export the whole "Document 2" tree the fastest way?
> There is for sure a faster way than moving the point to the headline
> "Document 2" and starting a subtree-export.
>
> Note:
> I am aware of the org-export-exclude-tags (:noexport:). But these
> require a to change the .org file just to export "Document 1" in
> between. I am looking for something like export-current-tree similar to
> export export-current-subtree.
>
>
> Any hints?
>
Write a function and bind it to a key - something like this perhaps:
--8<---------------cut here---------------start------------->8---
(defun ah-export-current-top-level-tree ()
(interactive)
(save-excursion
(outline-up-heading (org-current-level))
(let ((org-export-initial-scope 'subtree))
(org-export))))
--8<---------------cut here---------------end--------------->8---
Nick