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
    Jul 20 '15 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
    Jul 21 '15 at 0:13

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.