From: Eric Schulte <schulte.eric@gmail.com>
To: "Thomas S. Dye" <tsd@tsdye.com>
Cc: Org-mode <emacs-orgmode@gnu.org>, Nicolas Goaziou <n.goaziou@gmail.com>
Subject: Re: Bug in export of call lines
Date: Tue, 11 Mar 2014 19:40:27 -0600 [thread overview]
Message-ID: <8738iokoxy.fsf@gmail.com> (raw)
In-Reply-To: m261nkz9ph.fsf@tsdye.com
[-- Attachment #1: Type: text/plain, Size: 709 bytes --]
tsd@tsdye.com (Thomas S. Dye) writes:
> Hi Eric,
>
> Eric Schulte <schulte.eric@gmail.com> 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?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: good-newlines.org --]
[-- Type: text/x-org, Size: 260 bytes --]
#+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
[-- Attachment #3: Type: text/plain, Size: 99 bytes --]
>
> Also, AFAICT, the behavior of R source code blocks differs from others,
> including shell.
>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: bad-newlines.org --]
[-- Type: text/x-org, Size: 291 bytes --]
#+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
[-- Attachment #5: Type: text/plain, Size: 2179 bytes --]
>
> 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
next prev parent reply other threads:[~2014-03-12 4:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-07 2:05 Bug in export of call lines Thomas S. Dye
2014-03-10 12:16 ` Nicolas Goaziou
2014-03-10 17:14 ` Thomas S. Dye
2014-03-10 17:38 ` Eric Schulte
2014-03-11 2:45 ` Thomas S. Dye
2014-03-11 13:23 ` Eric Schulte
2014-03-11 21:50 ` Thomas S. Dye
2014-03-12 1:40 ` Eric Schulte [this message]
2014-03-12 6:00 ` Thomas S. Dye
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=8738iokoxy.fsf@gmail.com \
--to=schulte.eric@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=n.goaziou@gmail.com \
--cc=tsd@tsdye.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).