Nicolas Goaziou <n.goaz...@gmail.com> writes: > I suggest to use the dedicated MATCH argument for `org-map-entries': > > (defun as/delete-ignored-heading (backend) > "Remove every headline with a tag `ignoreheading' in the > current buffer. BACKEND is the export back-end being used, as > a symbol." > (org-map-entries > (lambda () (delete-region (point) (progn (forward-line) (point)))) > "+ignoreheading"))
Thank you, this works, with a big caveat (which makes this approach broken for me): with the following ECM --8<---------------cut here---------------start------------->8--- * No Export :noexport: test * Heading 1 :ignoreheading: foo * Heading 2 bar --8<---------------cut here---------------end--------------->8--- the text under "Heading 1" is no longer present. I suspect the heading is removed before the ":noexport:" is processed, which captures the text as well (which is bad: the reason for the heading in the first place is to end the ":noexport:" block). I went back to the stack-overflow suggestion. >> I have a followup question (purely from an aesthetic point of view, the >> code works fine). I see that a label is still generated in the LaTeX >> file (there is a "\label{sec-1}" with just the "\maketitle" above it). >> Is it expected? > > I don't think so. Though, after a quick test, I'm unable to reproduce > it. Do you have an ECM? It is indeed a problem with the stack-overflow solution and not with yours. I was confused when trying things out. Thanks, Alan