emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Juan Pechiar <juan@pechiar.com>
To: Christian Moe <mail@christianmoe.com>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: [BUG] LaTeX subtree export gives spurious "unbalanced begin/end_%s blocks" error
Date: Mon, 12 Dec 2011 09:02:58 -0200	[thread overview]
Message-ID: <20111212110258.GB12790@soloJazz.com> (raw)
In-Reply-To: <4EE5C13A.9080900@christianmoe.com>

I have the same problem.

It occurs on a 2nd pass through org-export-blocks-preprocess (in
org-exp-blocks.el).

1st pass runs OK, 2nd pass gets the error condition.

1st pass processes the following:

   (buffer-substring match-start (point-max)) ->
   "#+begin_src emacs-lisp\n  (message \"Hello, World!\")\n#+end_src\n"

2nd pass processes an emptied skeleton of the block

   (buffer-substring match-start (point-max)) ->
   "#+begin_src emacs-lisp\n#+end_src\n"

And fails to balance begin with end.

At this point in the code, the regular expression for matching
begin/end contains (I made ^M and tab visible here):

  inner-re  =   "[\r\n][\t ]*#\\+\\(begin\\|end\\)_src"

And this expression fails right away:

  (re-search-forward inner-re nil t)  ->  nil

I'll try to dig further into what's goning on.

Regards,
.j.

On Mon, Dec 12, 2011 at 09:54:18AM +0100, Christian Moe wrote:
> Hi,
>
> Here's a minimal document:
>
> ----BEGIN EXAMPLE----
>
> #+title: Testing
>
> * Src blocks
>
> Here's some Lisp:
>
> #+begin_src emacs-lisp
>   (message "Hello world!")
> #+end_src
>
> ----END EXAMPLE----
>
> When I try to export the "Src blocks" subtree to PDF via LaTeX, I
> get the error:
>
> "unbalanced begin/end_src blocks"
>
> Export of the whole document to PDF via LaTeX is not affected.
>
> Neither, initially, is HTML export, including subtree export to
> HTML. However, after getting an error by trying to export the
> subtree to LaTeX, I get the same error when trying to export to HTML
> (whether subtree or the whole document). I can "clear" the HTML
> export error by exporting the whole document via LaTeX again.

      reply	other threads:[~2011-12-12 11:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-12  8:54 [BUG] LaTeX subtree export gives spurious "unbalanced begin/end_%s blocks" error Christian Moe
2011-12-12 11:02 ` Juan Pechiar [this message]

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=20111212110258.GB12790@soloJazz.com \
    --to=juan@pechiar.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@christianmoe.com \
    /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).