Alan Schmitt <alan.schm...@polytechnique.org> writes: > Thanks a lot for the suggestion, here is what I ended up doing: > > #+begin_src emacs-lisp > (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 () > (when (member "ignoreheading" (org-get-tags-at nil t)) > (lambda () (delete-region (point) (progn (forward-line) > (point)))))))) > > (setq org-export-before-parsing-hook '(as/delete-ignored-heading)) > #+end_src
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")) > 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? Regards, -- Nicolas Goaziou