emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Wrong numbering after removal of headline


From: York Zhao
Subject: Re: [O] Wrong numbering after removal of headline
Date: Mon, 30 Jun 2014 18:23:18 -0400

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 <address@hidden> wrote:
> Hello,
>
> York Zhao <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]