emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: James Harkins <jamshark70@gmail.com>
Cc: orgmode <emacs-orgmode@gnu.org>
Subject: Re: org-element-map no-recursion argument?
Date: Thu, 30 Jan 2014 11:39:00 +0100	[thread overview]
Message-ID: <87r47pda9n.fsf@gmail.com> (raw)
In-Reply-To: <4e38543e-3fe5-47f2-a166-abe4a7a8d98a@dewdrop-world.net> (James Harkins's message of "Thu, 30 Jan 2014 10:26:14 +0800")

Hello,

James Harkins <jamshark70@gmail.com> writes:

> I've written some emacs-lisp using org-element-map to iterate over
> source code blocks in an org buffer and insert them into another
> buffer, including a listing number and caption (so it's different from
> tangling).
>
> I was just trying to tweak it to ignore source code blocks in
> a comment section.
>
> More specifically -- I had moved some material into a "Removed"
> subtree (with a tag "noexport"). This subtree contains some source
> blocks, but I want my function to ignore these.
>
> I thought I could wrap the entire "Removed" section in
> #+begin/end_comment, and then tell org-element-map to skip comment
> blocks for recursion.
>
> (org-element-map tree 'src-block (lambda (element) ...)
>  nil nil 'comment)
>
> But this has no effect. I guess the src-block filter erases the
> distinction between "live" and commented sections.
>
> I can work around it by commenting out the captions, but it would be
> nicer to have an entire "off-limits" section of the document.

This is a reasonable request, indeed.

One (backward compatible) solution could be to extend possible values
for NO-RECURSION argument, and allow functions on one argument (the
current element) in addition to symbols.

When the NO-RECURSION function returns a non-nil value for a given
element, the main function from `org-element-map' is applied to the
element, but not to its contents.


What do you think?


Regards,

-- 
Nicolas Goaziou

      reply	other threads:[~2014-01-30 10:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-30  2:26 org-element-map no-recursion argument? James Harkins
2014-01-30 10:39 ` Nicolas Goaziou [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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=87r47pda9n.fsf@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=jamshark70@gmail.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).