From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Bug in babel eating my text Date: Wed, 19 Jan 2011 18:54:57 -0500 Message-ID: <13076.1295481297@gamaville.americas.hpqcorp.net> References: <4D376B26.1050506@med.uni-goettingen.de> Reply-To: nicholas.dokos@hp.com Return-path: Received: from [140.186.70.92] (port=57352 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pfhrj-0007zf-4w for emacs-orgmode@gnu.org; Wed, 19 Jan 2011 18:55:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pfhrh-0006Jd-C9 for emacs-orgmode@gnu.org; Wed, 19 Jan 2011 18:55:02 -0500 Received: from g4t0014.houston.hp.com ([15.201.24.17]:32496) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pfhrh-0006Iv-2x for emacs-orgmode@gnu.org; Wed, 19 Jan 2011 18:55:01 -0500 In-Reply-To: Message from Andreas Leha of "Wed, 19 Jan 2011 23:52:22 +0100." <4D376B26.1050506@med.uni-goettingen.de> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Andreas Leha Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org Andreas Leha wrote: > I found a severe bug that actually eats my text, i.e. *destroys* my > org-mode file. > > Or am I missing something here? > > Just try that: > > * Test > > Execute this once: > #+BEGIN_src R :session test :results output silent :exports none > devnull <- library("tikzDevice") > #+END_src > > Execute this twice or more... but be careful > #+BEGIN_src R :session test :results output latex :exports results > tikz(console=TRUE, width=4, height=4) > plot(1:2,1:2) > devnull <- dev.off() > #+END_src > > * Watch me die :-( > I can reproduce this: it seems to be eating one character each time it is executed at the end of the #+END_LaTeX. Here's a patch that seems to fix this problem - however, it is not based on any real understanding of the code, so take it with a grain of salt. Also, if this fix works, then it is likely that the other "wrap" cases will also need similar treatment: diff --git a/lisp/ob.el b/lisp/ob.el index 82625c0..2ce57ca 100644 --- a/lisp/ob.el +++ b/lisp/ob.el @@ -1500,7 +1500,7 @@ code ---- the results are extracted in the syntax of the source ((member "html" result-params) (wrap "#+BEGIN_HTML\n" "#+END_HTML")) ((member "latex" result-params) - (wrap "#+BEGIN_LaTeX\n" "#+END_LaTeX")) + (wrap "#+BEGIN_LaTeX\n" "#+END_LaTeX\n")) ((member "code" result-params) (wrap (format "#+BEGIN_SRC %s%s\n" (or lang "none") results-switches) "#+END_SRC")) HTH, Nick