l.stelm...@samsung.com (Łukasz Stelmach) writes: > It was <2013-07-02 wto 13:06>, when Thorsten Jolitz wrote: >> l.stelm...@samsung.com (Łukasz Stelmach) writes: > This might be enough for me as I get the tree in the exporting > code. However, this way is far from efficient. If only there was a way > to find the current element in the tree. > > I am not sure yet, but a sequence of org-back-to-heading and > re-search-backward inside a save-excursion may be the easiest way to > place the point where I want it. > > Any other thoughts?
#+begin_src emacs-lisp (defun tj/export-enclosing-header (tag backend) "Export enclosing header with TAG member of tags." (save-excursion (unless (org-on-heading-p) (outline-previous-heading)) (while (not (member tag (org-get-tags))) (outline-up-heading 1)) (org-export-as backend 'SUBTREEP))) #+end_src then doing (with point e.g. at the src-block) ,------------------------------------------ | M-: (tj/export-enclosing-header "TASK" 'html) `------------------------------------------ works in my sample org file. Not sure if this what you are looking for -- cheers, Thorsten