all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thorsten Jolitz <tjolitz@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: finding a parent node
Date: Tue, 02 Jul 2013 14:12:48 +0200	[thread overview]
Message-ID: <87li5p40u7.fsf@gmail.com> (raw)
In-Reply-To: 87vc4tmbxd.fsf@samsung.com

l.stelmach@samsung.com (Łukasz Stelmach) writes:

> It was <2013-07-02 wto 13:06>, when Thorsten Jolitz wrote:
>> l.stelmach@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

      reply	other threads:[~2013-07-02 12:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-02  7:56 finding a parent node Łukasz Stelmach
2013-07-02  9:40 ` Thorsten Jolitz
2013-07-02 11:06 ` Thorsten Jolitz
2013-07-02 11:35   ` Łukasz Stelmach
2013-07-02 12:12     ` Thorsten Jolitz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87li5p40u7.fsf@gmail.com \
    --to=tjolitz@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.