emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: emacs-orgmode@gnu.org
Subject: Re: Adding #+LATEX: \newpage before section header using org-export-before-parsing-hook
Date: Wed, 08 Feb 2017 17:36:35 -0800	[thread overview]
Message-ID: <878tpgi1r0.fsf@pellet> (raw)
In-Reply-To: 877f50f918.fsf@alphaville.usersys.redhat.com

Nick Dokos <ndokos@gmail.com> writes:

> Joon Ro <joon.ro@outlook.com> writes:
>
>> So far I have done:
>>
>> (defun org/parse-headings (backend)
>>   (if (member backend '(latex))
>>       (org-map-entries
>>        (lambda ()
>>          (progn
>>            (insert-string "#+LATEX: \\newpage")
>>            ))
>>        "+newpage")
>>     )
>> )
>>
>> (add-hook 'org-export-before-parsing-hook 'org/parse-headings)
>>
>> This puts #+LATEX: \\newpage before the subheading, but the problem is if I try to do (insert-string "#+LATEX: \\newpage"), exporting gets stuck with the message "org-babel-exp process txt
>> at position 280541...". I suspect inserting a string messes up the position. How would I insert string with the newline character before a heading?
>>
> See the doc for org-map-entries - it says:
>
> ,----
> | The call to FUNC will be wrapped into a save-excursion form, so FUNC
> | does not need to preserve point.  After evaluation, the cursor will be
> | moved to the end of the line (presumably of the headline of the
> | processed entry) and search continues from there.  Under some
> | circumstances, this may not produce the wanted results.  For example,
> | if you have removed (e.g. archived) the current (sub)tree it could
> | mean that the next entry will be skipped entirely.  In such cases, you
> | can specify the position from where search should continue by making
> | FUNC set the variable ‘org-map-continue-from’ to the desired buffer
> | position.
> `----
>
> So you'll have to manipulate org-map-continue-from appropriately.

I would think it would be easier to add at export time using
`org-export-filter-headline-functions'.

Eric

  reply	other threads:[~2017-02-09  1:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-08 19:52 Adding #+LATEX: \newpage before section header using org-export-before-parsing-hook Joon Ro
2017-02-08 19:53 ` Joon Ro
2017-02-08 20:48 ` Thomas S. Dye
2017-02-09  0:01   ` Joon Ro
2017-02-09  1:27     ` Nick Dokos
2017-02-09  1:36       ` Eric Abrahamsen [this message]
2017-02-09  2:58       ` Joon Ro
2017-02-11 19:40         ` Joon Ro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878tpgi1r0.fsf@pellet \
    --to=eric@ericabrahamsen.net \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).