From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: ignoreheading in LaTeX export Date: Thu, 27 Mar 2014 14:28:08 +0100 Message-ID: <87d2h7srdj.fsf@gmail.com> References: <87y4zwrpp9.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60120) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTALS-0000fv-DV for emacs-orgmode@gnu.org; Thu, 27 Mar 2014 09:27:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WTALM-00088V-RT for emacs-orgmode@gnu.org; Thu, 27 Mar 2014 09:27:46 -0400 Received: from mail-wi0-x22d.google.com ([2a00:1450:400c:c05::22d]:50912) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTALM-00086U-Jw for emacs-orgmode@gnu.org; Thu, 27 Mar 2014 09:27:40 -0400 Received: by mail-wi0-f173.google.com with SMTP id f8so5971131wiw.12 for ; Thu, 27 Mar 2014 06:27:39 -0700 (PDT) In-Reply-To: (Alan Schmitt's message of "Thu, 27 Mar 2014 14:08:47 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Alan Schmitt Cc: emacs-orgmode Alan Schmitt 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