From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: Bug in export of call lines Date: Tue, 11 Mar 2014 19:40:27 -0600 Message-ID: <8738iokoxy.fsf@gmail.com> References: <87ha768d12.fsf@gmail.com> <87k3c2vts2.fsf@gmail.com> <87txb4n342.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55663) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNb24-00004w-L2 for emacs-orgmode@gnu.org; Wed, 12 Mar 2014 00:44:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WNb1z-0002bs-UO for emacs-orgmode@gnu.org; Wed, 12 Mar 2014 00:44:44 -0400 Received: from mail-pb0-x234.google.com ([2607:f8b0:400e:c01::234]:40935) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNb1z-0002bm-HY for emacs-orgmode@gnu.org; Wed, 12 Mar 2014 00:44:39 -0400 Received: by mail-pb0-f52.google.com with SMTP id rr13so551647pbb.11 for ; Tue, 11 Mar 2014 21:44:38 -0700 (PDT) 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 To: "Thomas S. Dye" Cc: Org-mode , Nicolas Goaziou --=-=-= Content-Type: text/plain tsd@tsdye.com (Thomas S. Dye) writes: > Hi Eric, > > Eric Schulte writes: > >> This actually is also an issue with shell code blocks. The fix is to >> customize the org-babel-inline-result-wrap variable (e.g., as follows) >> instead of setting the result type to RAW. >> >> (setq org-babel-inline-result-wrap "%s") >> >> Perhaps a note about this variable should be added to the description of >> inline code blocks (both call and src_*) in the manual. > > AFAICT, this variable has no effect on export of calls to R source code > blocks, where the source code block is set with :results raw. > Correct, however I believe the following should give the behavior you're after no? --=-=-= Content-Type: text/x-org Content-Disposition: inline; filename=good-newlines.org #+Options: ^:{} First set the inline result wrap. #+begin_src emacs-lisp :results silent (setq org-babel-inline-result-wrap "%s") #+end_src * Desirable newline behavior The call_r1() should not export with a newline. #+name: r1 #+begin_src R 2 #+end_src --=-=-= Content-Type: text/plain > > Also, AFAICT, the behavior of R source code blocks differs from others, > including shell. > --=-=-= Content-Type: text/x-org Content-Disposition: inline; filename=bad-newlines.org #+Options: ^:{} * Undesirable newline behavior :PROPERTIES: :results: raw :END: Both of these *do* introduce undesirable newlines. A shell code block call_shell2() and an R code block call_R2(). #+name: shell2 #+begin_src sh echo 2 #+end_src #+name: R2 #+begin_src R 2 #+end_src --=-=-= Content-Type: text/plain > > With the default value of org-babel-inline-result-wrap I get this > LaTeX > export: > > \section{Export this subtree raw to \LaTeX{}} > \label{sec-1} > Will shell-2 export 2 with a newline? > > Will r-2 export 2 with a newline? > > Will shell-2-raw export 2 with a newline? > > Will r-2-raw export 2 > with a newline? > \section{Export this subtree without raw to \LaTeX{}} > \label{sec-2} > > Will shell-2 export \texttt{2} with a newline? > > Will r-2 export \texttt{2} with a newline? > > Will shell-2-raw export \texttt{2} with a newline? > > \begin{verbatim} > Will r-2-raw export 2 > \end{verbatim} > with a newline? > % Emacs 24.3.1 (Org mode 8.2.5h) > > With org-babel-inline-result-wrap set to "%s" I get this: > > \section{Export this subtree raw to \LaTeX{}} > \label{sec-1} > Will shell-2 export 2 with a newline? > > Will r-2 export 2 with a newline? > > Will shell-2-raw export 2 with a newline? > > Will r-2-raw export 2 > with a newline? > \section{Export this subtree without raw to \LaTeX{}} > \label{sec-2} > > Will shell-2 export 2 with a newline? > > Will r-2 export 2 with a newline? > > Will shell-2-raw export 2 with a newline? > > \begin{verbatim} > Will r-2-raw export 2 > \end{verbatim} > with a newline? > % Emacs 24.3.1 (Org mode 8.2.5h) > > Note that there is no change in the LaTeX export of the R calls. > > I think this is a bug in ob-R.el. From my experiments, it behaves > differently than the other babel languages, including shell. > > For LaTeX export, the workaround is to avoid :results raw with R source > code blocks. Although a spurious newline is inserted into the source, > this is ignored by LaTeX. > I think it is allowable for raw results to include newlines. After if R returns a newline, the purpose of raw results is specifically to *not* change the result. I believe the best approach is to customize the inline results wrap as above, and then use non-raw processed results when inline results without newlines are desired. Does this sound reasonable? Best, > > All the best, > Tom -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D --=-=-=--