emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] LaTeX subtree export gives spurious "unbalanced begin/end_%s blocks" error
@ 2011-12-12  8:54 Christian Moe
  2011-12-12 11:02 ` Juan Pechiar
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Moe @ 2011-12-12  8:54 UTC (permalink / raw)
  To: Org Mode

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.

I'm using Org 7.7 (pulled this morning) on GNU Emacs 23.3.1 on a Mac.

Yours,
Christian

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [BUG] LaTeX subtree export gives spurious "unbalanced begin/end_%s blocks" error
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Juan Pechiar @ 2011-12-12 11:02 UTC (permalink / raw)
  To: Christian Moe; +Cc: Org Mode

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-12-12 11:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

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).