emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] finding a parent node


From: Thorsten Jolitz
Subject: Re: [O] finding a parent node
Date: Tue, 02 Jul 2013 14:12:48 +0200
User-agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux)

address@hidden (Łukasz Stelmach) writes:

> It was <2013-07-02 wto 13:06>, when Thorsten Jolitz wrote:
>> address@hidden (Ł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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]