emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Rainer@krugs.de
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: [BABEL] BUG Re: Omitting try/catch blocks from tangled R code?
Date: Fri, 07 Feb 2014 09:47:38 -0700	[thread overview]
Message-ID: <87siruamo3.fsf@gmail.com> (raw)
In-Reply-To: 52F498AE.6090802@krugs.de

Rainer M Krug <Rainer@krugs.de> writes:

> On 02/07/14, 07:18 , John Hendy wrote:
>> Greetings,
>> 
>> 
>> I don't usually tangle, but am creating a code file to go along with a
>> presentation I'm giving this weekend so that attendees can try things
>> out afterward by cloning my github repo where all the data and
>> necessary files are stored.
>> 
>> In my presentation (Beamer), I create plots via the R pdf() device,
>> and noticed that all of the tangled code where plots are generated
>> contains the following:
>> 
>> pdf(file="file.pdf"); tryCatch({
>> 
>>   code block contents here
>> 
>> },error=function(e){plot(x=-1:1, y=-1:1, type='n', xlab='', ylab='',
>> axes=FALSE); text(x=0, y=0, labels=e$message, col='red');
>> paste('ERROR', e$message, sep=' : ')}); dev.off()
>> 
>> Is there a way to omit this?
>
> This is a bug which must have been introduced some time ago - in the
> stock version of emacs (Org-mode version 7.9.3f
> (release_7.9.3f-17-g7524ef @
> /usr/local/Cellar/emacs/24.3/share/emacs/24.3/lisp/org/)) it does not
> tangle the enclosing commands to create graphics, but in 8.2 it does (I
> don't have an older version at hand to go further back).
>

I believe this was introduced by your commit eaa3a761d.  Reversion of
which with the following should provide a temporary workaround.

  git revert eaa3a761d

Perhaps the try/catch code should be moved from org-babel-expand-body:R
to org-babel-execute:R.  Alternately, the code should stay as is and you
should use the no-expand header argument during tangling.

I'm not sure which makes the most sense, but I'd lean towards the
former.

Best,

>
>> 
>> I'm guessing this is here to create a blank plot with the error as the
>> output when something goes awry?
>
> Yes.
>
>> 
>> I checked around variable completions of org-babel-tangle-* and
>> searched google for terms like "org babel tangle try catch" but am not
>> finding anything that looks like what I need.
>
> There is nothing, as it should not be tangled. The enclosing commands
> concern the export, but not tangling,
>
> I agree that the :result graphics header argument caused commands should
> not be in the tangled file.
>
> Another question is about the :epilogue and :prologue which I think
> should be present (haven't checked if they are...).
>
> Cheers,
>
> Rainer
>
>
>> 
>> 
>> Thanks,
>> John
>> 

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D

  reply	other threads:[~2014-02-07 16:56 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-07  6:18 Omitting try/catch blocks from tangled R code? John Hendy
2014-02-07  8:26 ` [BABEL] BUG " Rainer M Krug
2014-02-07 16:47   ` Eric Schulte [this message]
2014-02-07 19:22     ` Rainer M Krug
2014-03-12  1:13       ` John Hendy
2014-03-17 15:00         ` Eric Schulte
2014-03-17 17:11           ` John Hendy
2014-03-17 17:44             ` Eric Schulte
2014-03-18  8:44               ` Rainer M Krug
2014-03-18 21:56                 ` John Hendy
2014-03-19 19:07                   ` Charles Berry
2014-03-20  4:57                     ` Eric Schulte
2014-03-20  9:22                       ` Rainer M Krug
2014-03-24  2:03                         ` Eric Schulte
2014-03-24 10:22                           ` Rainer M Krug
2014-03-24 13:16                             ` Eric Schulte
2014-03-25  9:37                               ` Rainer M Krug
2014-03-26 20:17                                 ` Eric Schulte
2014-03-28  8:32                                   ` Rainer M Krug
2014-03-28  8:51                                   ` Rainer M Krug
2014-03-30 14:19                                     ` Eric Schulte
2014-03-31  7:52                                       ` Rainer M Krug
2014-04-02 23:09                                         ` Eric Schulte
2014-04-07  7:59                                           ` Rainer M Krug
2014-04-11  2:35                                             ` Eric Schulte

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=87siruamo3.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=Rainer@krugs.de \
    --cc=emacs-orgmode@gnu.org \
    /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).