emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rainer M Krug <Rainer@krugs.de>
To: Andreas Leha <andreas.leha@med.uni-goettingen.de>,
	emacs-orgmode@gnu.org, Eric Schulte <schulte.eric@gmail.com>,
	Eric Fraga <e.fraga@ucl.ac.uk>
Subject: :draft header argument for source block evaluation - WAS: [babel] suggestion: wrap creation of graphics into try() block
Date: Tue, 21 Jan 2014 11:43:12 +0100	[thread overview]
Message-ID: <52DE4F40.1060305@krugs.de> (raw)
In-Reply-To: <87zjmp1wk7.fsf@med.uni-goettingen.de>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



On 01/21/14, 11:03 , Andreas Leha wrote:
> Hi Rainer,
> 
> really cool.  I am very short on time right now, so I can't promise
> I'll get around to test it soon.

Great.

> 
> Just one comment:
> 
> Rainer M Krug <Rainer@krugs.de> writes:
> 
>> On 01/20/14, 19:38 , Eric Schulte wrote:
>>>> 
>>>> I will check it a little bit longer and see that I can
>>>> display the error message in the dummy graphic. Should have
>>>> it by tomorrow.
>>>> 
>>> 
>>> Sounds good.  Alternately, maybe you could get the R process
>>> to fail and print an error to STDERR so that the export will
>>> stop immediately and inform the user of the error.
>> 
>> I think it is better to catch the error and return with the 
>> computations in the next block, because
>> 
>> 1) a code block which produces a graph is most often an end
>> point, i.e. further blocks should (as I see it) not rely on the
>> output of this block
> 
> If all (your) documents follow that rule, that blocks producing 
> graphical output are not needed later on, than it might be cool to
> have an [draft]-like option in Org that by default replaces all
> images (not just failing ones) with a cheap-to-export graphic.  For
> some of my documents that is a real time saver.

I thought about that as well. a header argument :draft would be very
useful for *many* aspects.
Effectively, one could use the initially the following approach:

- - :draft null (default) :: everything as usual
- - :draft graphics :: Does not evaluate :results graphic blocks and
instead of the graphic, displays a "graphic" with "DRAFT - the code
block name if any", everything else as usual
- - :draft all :: does not evaluate *any* code block but instead returns
a message (if anything should be returned) with "DRAFT - the code
block name if any"

Something like this would be very useful, not only for R. It could be
useful to have this, as a per language header argument, but one could
start with R?


> 
> I can mimic that now by passing a variable 'draft' to the code
> blocks and deal with it internally.  But that means a lot of manual
> coding.
> 
>> 
>> 2) if the export continues, one can fix more then one error at a
>> time, so being more efficient.
>> 
>> 3) If the export continues, it makes it possible to use this to
>> create placeholder graphs:
>> 
>> #+begin_src R  :file TheFantasticGraph.pdf :results graphics 
>> stop("This is a placeholder for a new fantastic graph" #+end_src
>> 
>> Where TheFantasticGraph will display the message "This is a 
>> placeholder for a new fantastic graph".
>> 
>> I have now added the error to the normal R output in addition to
>> a graph, but the export is not canceled.
>> 
>> 
>>> 
>>>> 
>>>> I'll send you the patch then.
>>>> 
>>> 
>>> Sounds great, thanks.
>> 
>> OK - here it is attached (my first patch to org :-) ) - let me
>> know if it is OK.
>> 
> 
> Really nice addition!  Thanks already (without testing the patch)!

Thanks, and I hope it works as well on your side...

Cheers,

Rainer

> 
> [ ... ]
> 
> Regards, Andreas
> 
> 

- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer@krugs.de

Skype:      RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJS3k9AAAoJENvXNx4PUvmCnXEIANECzlTYZFBXOAVMGsl890jN
B4R5Ytq8Br09LDrB1HcnrZ59/rSRjLTBb8y2n+dn7uunsG3TlwK8GtqNYN2AXGDf
RUpwFrmbF4NxR6qCMQ/LiNp7ogEIyQgADEfLu9qvHB0yXcm7ylo3yqzDOirhMo1A
R3S57jUpPskfyEMcmVtco2k9SFYQ6qf5+IGQuVoOPKiN4L7HtTTNjW1YwQQmmIG9
W7krKxpFdqjlJYr9KzdMx8N8pskGKSvJTtJLFWElGAEvjopJvPQEeG8zLeaffL1M
EXarECSAbuS8ymjitBCuETDi0ShlYYOOiVCg/GJIGCwCS673cqky3QJkR/DO6dQ=
=JZYc
-----END PGP SIGNATURE-----

  reply	other threads:[~2014-01-21 10:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-20 13:36 [babel] suggestion: wrap creation of graphics into try() block Rainer M Krug
2014-01-20 14:00 ` Andreas Leha
2014-01-20 15:13   ` Rainer M Krug
2014-01-20 15:28     ` Eric Schulte
2014-01-20 17:02       ` Rainer M Krug
2014-01-20 18:38         ` Eric Schulte
2014-01-21  9:52           ` Rainer M Krug
2014-01-21 10:03             ` Andreas Leha
2014-01-21 10:43               ` Rainer M Krug [this message]
2014-01-26 18:07             ` Eric Schulte
2014-01-27  9:10               ` Rainer M Krug

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=52DE4F40.1060305@krugs.de \
    --to=rainer@krugs.de \
    --cc=andreas.leha@med.uni-goettingen.de \
    --cc=e.fraga@ucl.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    --cc=schulte.eric@gmail.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).