From: Rainer M Krug <Rainer@krugs.de>
To: Andreas Kiermeier <andreas.kiermeier@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: header arguments, inheritance, and noweb expansion Was: «Macro» expansion in source blocks; code-sharing between blocks
Date: Fri, 19 Sep 2014 12:59:56 +0200 [thread overview]
Message-ID: <m2tx43j2oj.fsf_-_@krugs.de> (raw)
In-Reply-To: <CAN7vk5RKrHX17WXDepYZty+__7BrS6SHbBjudq7+J3J4ftCEoQ@mail.gmail.com> (Andreas Kiermeier's message of "Fri, 19 Sep 2014 19:49:15 +0930")
[-- Attachment #1: Type: text/plain, Size: 4723 bytes --]
Andreas Kiermeier <andreas.kiermeier@gmail.com> writes:
> Thanks Rainer,
>
> but unfortunately this isn't working. I'm sure I'm doing something
> wrong ... somewhere.
>
> In case this makes any difference I have in the document header:
>
> #+PROPERTY: header-args:R :session *R*
> #+PROPERTY: header-args :results output graphics :exports results
>
> I've now changed the source block header to ":exports none :eval no"
> but now there really is nothing in the output.
>
> In fact, the corresponding .tex file now contains:
>
> \begin{table}[h]
> \label{tbl:refyear}
> \caption{Separation outcomes (death or any type of discharge) by
> reference year.}
> nil
> \end{table}
>
> and in the *Message* buffer I now have:
>
> Evaluation of this R code-block (tbl-refyear) is disabled.
> org-babel-exp processing...
> Evaluation of this R code-block (tbl-refyear) is disabled.
> executing Latex code block...
>
> So, this source block really doesn't evaluated at all.
This boils down to the question I asked earlier about header-args and
+header args, inheritance of header arguments and this in contrast to
normal header args.
Based on this discussion, I thought that the header arguments count
*where the code is executed* and not where it is defined - well -
surprise for me.
You could try and put the code block with the definition of the code
into a subtree where you set
,----
| :PROPERTIES:
| :headser-args+: eval no
| :END:
`----
This might work?
Rainer
>
> Thanks
>
> Andreas
>
> On 19 September 2014 18:34, Rainer M Krug <Rainer@krugs.de> wrote:
>> Andreas Kiermeier <andreas.kiermeier@gmail.com> writes:
>>
>>> I don't think you need the ":noweb yes" as part of the setup_fu
>>> header, as this block is not pulling in other materials.
>>>
>>> Having used this type of setup only over the last couple of days, I've
>>> come up with another question. It appears that the setup_fu is
>>> executed twice ... once as it's own source block (though by itself not
>>> need) and once as part of the second noweb block. This isn't a problem
>>> if the execution time is small, but I'm trying to create a summary
>>> table in Latex format from 2 million records - so the time is
>>> considerable.
>>>
>>
>> Check out the :eval header argument: if you use
>>
>> ,----
>> | #+BEGIN_SRC R :eval never :exports none
>> `----
>>
>> this block is never executed - this should work. There are also other
>> values for :eval. From the help:
>>
>> ,----
>> | 14.8.2.25 `:eval'
>> | .................
>> |
>> | The `:eval' header argument can be used to limit the evaluation of
>> | specific code blocks. The `:eval' header argument can be useful for
>> | protecting against the evaluation of dangerous code blocks or to ensure
>> | that evaluation will require a query regardless of the value of the
>> | `org-confirm-babel-evaluate' variable. The possible values of `:eval'
>> | and their effects are shown below.
>> |
>> | `never or no'
>> | The code block will not be evaluated under any circumstances.
>> |
>> | `query'
>> | Evaluation of the code block will require a query.
>> |
>> | `never-export or no-export'
>> | The code block will not be evaluated during export but may still
>> | be called interactively.
>> |
>> | `query-export'
>> | Evaluation of the code block during export will require a query.
>> |
>> | If this header argument is not set then evaluation is determined by
>> | the value of the `org-confirm-babel-evaluate' variable see *Note Code
>> | evaluation security::.
>> `----
>>
>> Cheers,
>>
>> Rainer
>>
>>
>>> My two blocks (with some code removed for simplicity) are as follow:
>>>
>>> #+NAME: tbl-refyear
>>> #+BEGIN_SRC R :results silent :exports none
>>> latex(tabular( <code remove> ))
>>> #+END_SRC
>>>
>>> #+BEGIN_SRC latex :noweb yes
>>> \begin{table}[h]
>>> \label{tbl:refyear}
>>> \caption{Separation outcomes (death or any type of discharge) by
>>> reference year.}
>>> <<tbl-refyear()>>
>>> \end{table}
>>> #+END_SRC
>>>
>>> I've tried :cache yes as part of the tbl-refyear source block, but
>>> that didn't stop if from being run twice. Am I missing a suitable
>>> header argument?
>>>
>>> This is the only way I could find to wrap the latex table (which has
>>> some complex formatting and hence why I've used it over just producing
>>> a table) in a float with a caption (though I still can't properly
>>> reference the label when I export to a PDF file).
>>>
>>> Any thought would be greatly appreciated. TIA!
>>>
>>> Andreas
>
>
--
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982
[-- Attachment #2: Type: application/pgp-signature, Size: 494 bytes --]
next prev parent reply other threads:[~2014-09-19 11:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-18 13:17 «Macro» expansion in source blocks; code-sharing between blocks Tobias Getzner
2014-09-18 13:26 ` Tobias Getzner
2014-09-18 14:01 ` Eric S Fraga
2014-09-18 14:40 ` Tobias Getzner
2014-09-18 23:44 ` Andreas Kiermeier
2014-09-19 2:59 ` Charles Berry
2014-09-19 10:18 ` Andreas Kiermeier
2014-09-19 7:44 ` Eric S Fraga
2014-09-19 9:04 ` Rainer M Krug
2014-09-19 10:19 ` Andreas Kiermeier
2014-09-19 10:59 ` Rainer M Krug [this message]
2014-09-20 6:57 ` header arguments, inheritance, and noweb expansion Was: " Andreas Kiermeier
2014-09-20 16:06 ` Charles Berry
2014-09-21 4:19 ` Andreas Kiermeier
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2tx43j2oj.fsf_-_@krugs.de \
--to=rainer@krugs.de \
--cc=andreas.kiermeier@gmail.com \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.