From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Force new page on exporting Date: Tue, 01 Jul 2014 12:21:42 -0400 Message-ID: <87bnt9aw2x.fsf@alphaville.bos.redhat.com> References: <87k37xaygu.fsf@alphaville.bos.redhat.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X20op-00077l-Oy for emacs-orgmode@gnu.org; Tue, 01 Jul 2014 12:22:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X20oi-0005dS-9Y for emacs-orgmode@gnu.org; Tue, 01 Jul 2014 12:22:07 -0400 Received: from plane.gmane.org ([80.91.229.3]:41928) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X20oi-0005d0-2N for emacs-orgmode@gnu.org; Tue, 01 Jul 2014 12:22:00 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1X20oe-0007eY-AW for emacs-orgmode@gnu.org; Tue, 01 Jul 2014 18:21:56 +0200 Received: from nat-pool-bos-t.redhat.com ([66.187.233.206]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 01 Jul 2014 18:21:56 +0200 Received: from ndokos by nat-pool-bos-t.redhat.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 01 Jul 2014 18:21:56 +0200 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: emacs-orgmode@gnu.org York Zhao writes: >> My understanding is that you need extra machinery to implement "ignoreheading" > > I had implemented machinery the "ignoreheading" and posted the code in the post > "Wrong numbering after removal of headline". But anyways here's my code: > > (defun yz/org-export-process-heading-removal (backend) > "Ignore headlines with tag `ignoreheading'." > (save-excursion > (let ((org-allow-promoting-top-level-subtree t)) > (org-map-entries > (lambda () > (when (member "removeheading" (org-get-local-tags)) > (org-promote-subtree) > (delete-region (line-beginning-position) > (progn (forward-line) (point))))))))) > > (add-hook 'org-export-before-parsing-hook > #'yz/org-export-process-heading-removal) > > This code worked for ignoring the headline with tag "removeheading", and did > re-numbering all the headlines properly. But: > > * Latex New Page :ignoreheading: > #+latex: \newpage > > Still didn't work which I have no idea at this moment yet. Any idea? So before parsing, you are getting rid of the "ignoreheading" [fn:1] headline (first, "promoting" it to a comment and then deleting the region), so the #+latex: \newpage line now belongs to headline 2 which is then parsed and discarded. I think you need a filter after parsing (which of course conflicts with your need in the "Wrong numbering..." thread). Footnotes: [fn:1] there is a "removeheading" vs "ignoreheading" inconsistency, btw.