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.
hjh