I'd like to specify a heading (using either link or agenda syntax) and export just that heading as a file, using elisp.

I'm not trying to do this - since this specifies the file to export to in the file itself: How to export top-level headings of org-mode buffer to separate files?

I think it might involve specific input to org-export-as? (a function in ox.el)

  • Maybe a combination of org-link-search with org-narrow-to-subtree? I think, by default, Org will export the narrowed buffer rather than the entire document.
    – wvxvw
    Commented Jul 20, 2015 at 5:49
  • That helped a bit, and I discovered save-excursion which helps not mess up document state as I do things (I'm relatively new to elisp). This is a step in the right direction: (save-excursion (org-link-search link-string) (org-html-export-to-html nil t nil '()). However, it doesn't for example make the title the selected heading, or keep normal export options, even if I replace '() with a call to org-export-get-environment.
    – avv
    Commented Jul 21, 2015 at 0:13


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.