From mboxrd@z Thu Jan 1 00:00:00 1970 From: York Zhao Subject: Re: Wrong numbering after removal of headline Date: Mon, 30 Jun 2014 18:23:18 -0400 Message-ID: References: <87d2dqnkmj.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55557) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1jyp-00051y-Ta for emacs-orgmode@gnu.org; Mon, 30 Jun 2014 18:23:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1jyo-00057x-Vt for emacs-orgmode@gnu.org; Mon, 30 Jun 2014 18:23:19 -0400 Received: from mail-ve0-x236.google.com ([2607:f8b0:400c:c01::236]:43408) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1jyo-00057g-Rt for emacs-orgmode@gnu.org; Mon, 30 Jun 2014 18:23:18 -0400 Received: by mail-ve0-f182.google.com with SMTP id oy12so8993880veb.27 for ; Mon, 30 Jun 2014 15:23:18 -0700 (PDT) In-Reply-To: <87d2dqnkmj.fsf@nicolasgoaziou.fr> 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: York Zhao , emacs-orgmode Hi Nicolas, > Don't do that at the filter level, which is too late for heavy structure > editing. Use `org-export-before-parsing-hook' instead. I realized this, and had changed to use `org-export-before-parsing-hook', here is my code: (defun my-headline-removal (backend) "Ignore headlines with tag `ignoreheading'." (save-excursion (when (eq org-export-current-backend 'latex) (org-map-entries (lambda () (when (member "ignoreheading" (org-get-tags-at nil 'local)) (save-excursion (org-map-tree 'org-promote)) (delete-region (line-beginning-position) (line-end-position)))))))) (add-hook 'org-export-before-parsing-hook 'my-headline-removal) But I'm getting the error: "org-map-tree: Symbol's value as variable is void: org-called-with-limited-levels". Any idea? Thanks On Mon, Jun 30, 2014 at 5:38 PM, Nicolas Goaziou wrote: > Hello, > > York Zhao writes: > >> As an example, I have the follow org-mode buffer: >> >> * Level1 >> ** Level2 >> *** Level3 >> >> If I export this to LaTeX (C-x C-e l p), it produces the following: >> >> >> Contents >> >> 1 Level1 >> 1.1 Level2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . >> 1.1.1 Level3 . . . . . . . . . . . . . . . . . . . . . . . . . . . >> >> >> Which is good. However, since what I need is that I don't want to produce the >> "level1" heading, so I added the following code: >> >> (defun yz/org-export-ignore-headline (contents backend info) >> "Ignore headlines with tag `ignoreheading'." >> (when (and (org-export-derived-backend-p backend 'latex 'html 'ascii) >> (string-match "\\`.*ignoreheading.*\n" (downcase contents))) >> (replace-match "" nil nil contents))) >> >> (add-to-list 'org-export-filter-headline-functions >> 'yz/org-export-ignore-headline) > > Don't do that at the filter level, which is too late for heavy structure > editing. Use `org-export-before-parsing-hook' instead. See section > 12.14 in manual for an example. > > > Regards, > > -- > Nicolas Goaziou