From 1e19e5174e21e8ddfd96ed5da5c2cbbb444e9d16 Mon Sep 17 00:00:00 2001 From: Ondrej Grover Date: Sun, 12 Apr 2015 13:43:31 +0200 Subject: [PATCH] org.texi: Extend export hook example with ignore_heading tag support * doc/org.texi (Advanced configuration): Extend the pre-processing export hook example to support similar (but simpler and more general) functionality like that provided by the ignoreheading tag in the Beamer export backend. This is a commonly requested snippet and the Internet is full of much worse and broken solutions, so the manual should show the recommended solution. TINYCHANGE --- doc/org.texi | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index c400f77..8dc0a92 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -13811,24 +13811,29 @@ one, @code{org-export-before-processing-hook} is called before expanding macros, Babel code and include keywords in the buffer. The second one, @code{org-export-before-parsing-hook}, as its name suggests, happens just before parsing the buffer. Their main use is for heavy duties, that is -duties involving structural modifications of the document. For example, one -may want to remove every headline in the buffer during export. The following -code can achieve this: +duties involving structural modifications of the document. For example, one +may want to remove every headline with the @samp{ignore_heading} tag in the +buffer during export. The following code can achieve this: @lisp @group -(defun my-headline-removal (backend) - "Remove all headlines in the current buffer. +(defun ignored-headlines-removal (backend) + "Remove all headlines with the ignore_headline tag 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)))))) + (lambda () (delete-region (point) (progn (forward-line) (point)))) + "ignore_heading")) -(add-hook 'org-export-before-parsing-hook 'my-headline-removal) +(add-hook 'org-export-before-parsing-hook 'ignored-headlines-removal) @end group @end lisp -Note that functions used in these hooks require a mandatory argument, -a symbol representing the back-end used. +The second argument to the @code{org-map-entries} function is an agenda-style +match query string. Note the underscore in the tag, it is not recommended to +use the @samp{ignoreheading} tag because the Beamer export backend treates it +in a similar, yet more complicated way. Also note that functions used in +these hooks require a mandatory argument, a symbol representing the back-end +used. @subheading Filters -- 2.1.4