From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Formatting R output Date: Mon, 10 Sep 2012 11:17:12 -0400 Message-ID: <25761.1347290232@alphaville> References: <25606.1347289599@alphaville> Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([208.118.235.92]:55507) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TB5jm-0002vL-LH for emacs-orgmode@gnu.org; Mon, 10 Sep 2012 11:17:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TB5ji-0004sk-Fa for emacs-orgmode@gnu.org; Mon, 10 Sep 2012 11:17:22 -0400 Received: from g4t0015.houston.hp.com ([15.201.24.18]:20022) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TB5ji-0004sf-9Y for emacs-orgmode@gnu.org; Mon, 10 Sep 2012 11:17:18 -0400 In-Reply-To: Message from Nick Dokos of "Mon, 10 Sep 2012 11:06:39 EDT." <25606.1347289599@alphaville> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Cc: emacs-orgmode@gnu.org, "G. Jay Kerns" Nick Dokos wrote: > G. Jay Kerns wrote: > > > > From: Neuwirth Erich univie.ac.at> > > > ... > > > 1) a mild annoyance. > > > > > > src_R{1+1} inserts the result 2 in the output. In fact, it inserts =2=. > > > When one runs the file repeatedly, org-mode does not remove older results. > > > So if I replace src_R{1+1} by src_R{2+2} and do not remove the last output, > > > My file will contain > > > > > > src_R{2+2} =4= =2= > > > > > > Also, If I run the inline code segment by C-c C-c one, the org file ail contain just 1 > > > correct result, bit if afterwards I export the file (to LaTeX or html), > > > the exported file will have 2 copies of the result. > > > > > > Is there anything the developers can do about this? > > > > I can confirm that if a person does not remove old output but changes > > input to the inline code segment then the exported file will have both > > the correct output plus the (old) incorrect output. My strategy to > > avoid this is use C-c C-c sparingly just to check whether the output > > is as expected, then always erase output. If I am going to use an org > > file with C-c C-c a lot (for a lecture, say), then I keep a copy for > > exporting clean and separate from the one I am going to do a lot of > > C-c C-c'ing with. YMMV. > > > > IMO, the solution would come in two pieces: > > - an org-babel-before-execute-hook to complement the org-babel-after-execute-hook > - fixing org-remove-result to work with inline source code blocks - my > attempt to use it zapped the closing brace as well as the actual > result: "This is R code: src_R{2 + 2". > Scratch that: org-babel-remove-result would need delimiters to know what to remove. It currently removes everything to the end of the line which seems not quite kosher, but I'm not sure what the correct thing to do would be. Nick